Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove shell reload message for fish #4150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions sky/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ def _get_shell_complete_args(complete_fn):


_RELOAD_ZSH_CMD = 'source ~/.zshrc'
_RELOAD_FISH_CMD = 'source ~/.config/fish/config.fish'
_RELOAD_BASH_CMD = 'source ~/.bashrc'


Expand Down Expand Up @@ -378,7 +377,7 @@ def _install_shell_completion(ctx: click.Context, param: click.Parameter,
cmd = '_SKY_COMPLETE=fish_source sky > \
~/.config/fish/completions/sky.fish'

reload_cmd = _RELOAD_FISH_CMD
reload_cmd = None

elif value == 'zsh':
install_cmd = f'_SKY_COMPLETE=zsh_source sky > \
Expand All @@ -398,9 +397,10 @@ def _install_shell_completion(ctx: click.Context, param: click.Parameter,
check=True,
executable=shutil.which('bash'))
click.secho(f'Shell completion installed for {value}', fg='green')
click.echo(
'Completion will take effect once you restart the terminal: ' +
click.style(f'{reload_cmd}', bold=True))
if reload_cmd is not None:
click.echo(
'Completion will take effect once you restart the terminal: ' +
click.style(f'{reload_cmd}', bold=True))
except subprocess.CalledProcessError as e:
click.secho(f'> Installation failed with code {e.returncode}', fg='red')
ctx.exit()
Expand Down Expand Up @@ -431,7 +431,7 @@ def _uninstall_shell_completion(ctx: click.Context, param: click.Parameter,

elif value == 'fish':
cmd = 'rm -f ~/.config/fish/completions/sky.fish'
reload_cmd = _RELOAD_FISH_CMD
reload_cmd = None

elif value == 'zsh':
cmd = 'sed -i"" -e "/# For SkyPilot shell completion/d" ~/.zshrc && \
Expand All @@ -447,8 +447,10 @@ def _uninstall_shell_completion(ctx: click.Context, param: click.Parameter,
try:
subprocess.run(cmd, shell=True, check=True)
click.secho(f'Shell completion uninstalled for {value}', fg='green')
click.echo('Changes will take effect once you restart the terminal: ' +
click.style(f'{reload_cmd}', bold=True))
if reload_cmd is not None:
click.echo(
'Changes will take effect once you restart the terminal: ' +
click.style(f'{reload_cmd}', bold=True))
except subprocess.CalledProcessError as e:
click.secho(f'> Uninstallation failed with code {e.returncode}',
fg='red')
Expand Down
Loading