Skip to content

completion/ssh-copy-id: add completion #9675

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

Merged
merged 4 commits into from
Mar 22, 2023

Conversation

NextAlone
Copy link
Contributor

@NextAlone NextAlone commented Mar 21, 2023

  • completion/ssh-copy-id: add completion

Description

Talk about your changes here.

Fixes issue #

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
Comment on lines 2 to 4
function __ssh_history_completions
history --prefix ssh --max=100 | string replace -rf '.* ([A-Za-z0-9._:-]+@[A-Za-z0-9._:-]+).*' '$1'
end
Copy link
Contributor

@mqudsi mqudsi Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how I feel about this. You're copying the function definition from ssh.fish but you're not giving it a new name. If someone runs into an issue with ssh.fish's function at some later date, they might end up running into issues trying to see why their function definition isn't being reflected.

Since there's a good chance ssh.fish was already loaded, you can try type -q __ssh_history_completions || source ./ssh.fish at the top of this script, or move __ssh_history_completions to its own file in share/functions/__ssh_history_completions.fish.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got that, just extract to a split function in function folder.

@mqudsi mqudsi added this to the fish 3.6.1 milestone Mar 22, 2023
Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
@mqudsi mqudsi merged commit 45b6622 into fish-shell:master Mar 22, 2023
mqudsi pushed a commit that referenced this pull request Mar 22, 2023
Add completions for ssh-copy-id.

Refactored __ssh_history_completions into its own file for autoloading across
completions.

(cherry picked from commit 45b6622)

Conflicts:
	CHANGELOG.rst
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants