Augment .bashrc
This commit is contained in:
parent
057cd602f2
commit
84f0d9e43d
20
install.py
20
install.py
@ -259,3 +259,23 @@ nvim_plug_vim_dir.mkdir(parents=True, exist_ok=True)
|
|||||||
if not os.path.exists(nvim_plug_vim_path):
|
if not os.path.exists(nvim_plug_vim_path):
|
||||||
devenver.lprint(f"Installing NVIM plugin manager to {nvim_plug_vim_path}")
|
devenver.lprint(f"Installing NVIM plugin manager to {nvim_plug_vim_path}")
|
||||||
urllib.request.urlretrieve("https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim", nvim_plug_vim_path)
|
urllib.request.urlretrieve("https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim", nvim_plug_vim_path)
|
||||||
|
|
||||||
|
# Source dev_env.sh in ~/.bashrc (Linux only)
|
||||||
|
if not is_windows:
|
||||||
|
bashrc_path = pathlib.Path(os.path.expanduser("~/.bashrc"))
|
||||||
|
devenv_script_path = install_dir / "dev_env.sh"
|
||||||
|
source_line = f'source "{devenv_script_path}"'
|
||||||
|
|
||||||
|
# Check if already present
|
||||||
|
already_present = False
|
||||||
|
if bashrc_path.exists():
|
||||||
|
bashrc_content = bashrc_path.read_text()
|
||||||
|
if source_line in bashrc_content:
|
||||||
|
already_present = True
|
||||||
|
|
||||||
|
if not already_present:
|
||||||
|
devenver.lprint(f"Adding dev_env.sh source line to {bashrc_path}")
|
||||||
|
with open(bashrc_path, "a") as f:
|
||||||
|
f.write(f"\n{source_line}\n")
|
||||||
|
else:
|
||||||
|
devenver.lprint(f"dev_env.sh source line already exists in {bashrc_path}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user