Skip to content

Fix ssh completions and ssh provided hostnames - #4104

Merged
faho merged 2 commits into
fish-shell:masterfrom
magenta404:master
Jun 10, 2017
Merged

faho merged 2 commits into
fish-shell:masterfrom
magenta404:master

Conversation

@magenta404

Copy link
Copy Markdown
Contributor

This is a quick patch. Very sorry about missing this, but the ssh provided hostnames did not include the root ssh config – only the hostnames discovered through files included with the Include directive.

Also, if an Include directive contained a wildcard which resolved to nothing, echo would complain which this patch fixes as well.

@faho faho added bug Something that's not working as intended completions labels Jun 6, 2017
@faho faho added this to the fish 2.7.0 milestone Jun 6, 2017
@faho faho mentioned this pull request Jun 6, 2017
set -l new_paths
for path in $paths
# Guard against echo command complaining on zero wildcard matches
if test (eval "count $path") -gt 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use set to inhibit the glob match failure:

set -l expanded_path
eval set expanded_path (echo $path)
for path in $expanded_path

This is a good example for why we should implement the proposed glob command.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Perfect. Thank you. I have amended the commit.

eval set expanded_path (echo $path)
for path in $expanded_path
# Resolve "relative" paths in accordance to ssh path resolution
if string match -v '/*' $path >/dev/null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rather than redirect the output use the -q flag.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Fixed.

@krader1961

Copy link
Copy Markdown
Contributor

Other than one minor nit about using -q rather than redirecting the output of string match this LGTM. @faho, or anyone else, see any problems with this?

@faho

faho commented Jun 9, 2017

Copy link
Copy Markdown
Member

@krader1961: That was the only thing I noticed, so LGTM. And yes, that eval is needed here is quite annoying.

@faho
faho merged commit 2b4f61f into fish-shell:master Jun 10, 2017
@faho

faho commented Jun 10, 2017

Copy link
Copy Markdown
Member

Merged, thanks!

I'm working on a expand builtin that could be used instead of eval here.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something that's not working as intended completions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants