[tools] support Env for fish shell

This commit is contained in:
1ridic 2023-09-14 21:18:20 +08:00 committed by GitHub
parent 12592458b9
commit ec9bbaceda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -219,6 +219,11 @@ def touch_env():
if sys.platform != 'win32':
env_sh = open(os.path.join(env_dir, 'env.sh'), 'w')
env_sh.write('export PATH=~/.env/tools/scripts:$PATH')
# if fish config exists, generate env.fish
if os.path.exists(os.path.join(home_dir, '.config', 'fish', 'config.fish')):
env_fish = open(os.path.join(env_dir, 'env.fish'), 'w')
env_fish.write('set -gx PATH ~/.env/tools/scripts $PATH')
else:
if os.path.exists(os.path.join(env_dir, 'tools', 'scripts')):
os.environ["PATH"] = os.path.join(env_dir, 'tools', 'scripts') + ';' + os.environ["PATH"]