Commit Graph

30 Commits

Author SHA1 Message Date
Dale Eidd
eff6b98813 numerous improvements to ssh/scp completions
Add IPV6 /etc/hosts completion support. Parses columns rather than values which produces improved output.

Support ssh -F and Include completion

Ignore ssh Hostname and Host with wildcard. The following only get in the way:

- Hostname: Host resolves to Hostname
- Wildcard Host: Cannot ssh to a glob pattern

Improve scp completions

* complete only local files when no host provided
* complete only remote files when host is provided
* complete local files or hosts when no separator

Disable username completion for ssh/scp

Username completion only provides local users which will unlikely be
useful on a remote machine. ssh will use the current username (the only
useful one) or one provided in the ssh config.
2017-02-01 22:12:49 -08:00
Kurtis Rader
42eaacd3a1 enable make style-all doing fish scripts
I had disabled having `make style-all` restyling fish scripts because a
majority of them did not conform to the style enforced by `fish_indent`.
I recently restyled most of the fish scripts with the exception of the
completion scripts. So this re-enables restyling all scripts with the
exception of completion scripts.
2016-12-03 20:39:32 -08:00
Kurtis Rader
1ca1667786 fix bug introduced by fish_indent
Commit 11a60c8 restyled all the fish scripts using fish_indent. Sadly a
bug in fish_indent did not correctly reformat an unusual structure.
2016-11-28 17:13:01 -08:00
Kurtis Rader
11a60c8374 reformat all fish scripts
I hate doing this but I am tired of touching a fish script as part of
some change and having `make style` radically change it. Which makes
editing fish scripts more painful than it needs to be. It is time to do
a wholesale reformatting of these scripts to conform to the documented
style as implemented by the `fish_indent` program.
2016-11-27 21:27:22 -08:00
Scott Bonds
99351fcb44 Don't use getent to list hosts if its not supported (#3259)
Fixes #2137 on OpenBSD
2016-07-23 13:24:12 +02:00
Boris Aranovich
cbe97ac1a1 Refine reading ssh_config (#3146)
https://www.freebsd.org/cgi/man.cgi?query=ssh_config&sektion=5
1. It is possible to add multiple whitespace characters between the keyword (i.e. Host) and the argument(s).
2. It is allowed to have a single = and whitespace between the keyword and the argument(s).
3. It is possible to add multiple host names under a single Host directive by spacing the names apart.

1. and 3. are actual conventions that we use in our team, and I couldn't get auto-complete working for fish without this modification.

Modification explained:
a. The space between Host(?:name)? and the \w.* was replaced by (?:\s+|\s*=\s*) to match any sequence of whitespace characters, or optional whitespaces with a single =, per spec.
b. Result of first replacement is piped through another string replace to switch duplicate whitespace characters to a single space, and then piped to be split by that space. This allows specifying several aliases or host names in a single Host/Hostname definition, also per spec.
2016-06-15 17:54:40 +02:00
Aaron Gyes
36691df6fe Stringify many completions and functions, with --invert stringification.
I believe apm must have been buggy - example output that I found online
showed `tr` was mangling paths with spaces in it. Should be fixed.

Also, use dscl on OS X in __fish_complete_users.fish like
__fish_print_users.fish already does.
2016-04-08 10:49:29 +08:00
Fabian Homborg
a81bd697a8 Make reading ssh files case-insensitive
Fixes #2843
2016-03-22 11:09:36 +01:00
Fabian Homborg
fbd53f2da1 Check ssh's KnownhostsFiles in print_hostnames
These are an additional source of information

Thanks to @sysbot (#2313) for the inspiration.

This also stringifies the ssh_config reading
2016-03-02 15:16:52 +01:00
Fabian Homborg
65aeaab054 print_hostname: Avoid matches in fstab comments harder 2016-03-02 15:16:52 +01:00
Fabian Homborg
94c12d84e2 Stringify reading nfs in print_hostnames 2016-03-02 15:16:52 +01:00
Fabian Homborg
a5f5e6c1ef Ignore zero-ips in print_hostnames
This would be a lot of useless options for those who block via hosts.
2016-03-02 15:16:42 +01:00
Fabian Homborg
b9b39f7c31 Replace sed -E with string replace
This is to the benefit of systems with ancient GNU sed, which does not
recognize "-E", but only "-r".

Fixes #2305 - even if it doesn't replace all `sed -E` invocations in the
codebase, the others are unlikely to occur on CentOS and other similarly
crusty systems.
2015-09-28 20:06:20 +02:00
Fabian Homborg
b85a8bbbfe Rename sgrep to __fish_sgrep
Makes it harder to cause issues with aliases, see fish-shell#2245
2015-09-09 20:55:04 +02:00
David Adam
7d94b7fd1b __fish_print_hostnames: ignore errors from getent
Closes #2137.
2015-06-19 16:42:48 +08:00
David Adam
f0d8d90ed1 __fish_print_hostnames: use awk to process ssh_config files
Uses awk rather than sed to account for multiple formatting options.

Closes #1260.
2014-09-29 14:08:09 +08:00
Michael Stillwell
133ba6e01b Ignore "host", "hostname", and hostname wildcards
See the PATTERNS section of ssh_config(5) for wildcards supported by ssh.
2014-09-16 17:20:59 +02:00
Knut Ahlers
1270384ede Fixed appearance of ssh hostnames with [] in them
refs https://github.com/fish-shell/fish-shell/issues/1355
2014-03-29 11:46:45 +01:00
Alexander I.Grafov
75b02e1d27 Fixes issue #1234. Fish now parses system wide ssh configuration file in addition to user config. 2014-01-12 14:59:46 +05:30
David Adam
c2dcfc9176 __fish_print_hostnames: do a better job of searching SSH files 2013-09-19 23:24:36 +08:00
ridiculousfish
0970487cca Some spaces to tabs in __fish_print_hostnames 2013-04-03 18:46:50 -07:00
Greg Dietsche
d38f1380e9 Ignore hashed host names in ssh/known_hosts
Valid DNS names cannot have a | character and hashed ssh hosts
always begin with the | character. Therefore we ignore lines that
begin with |.

Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
2013-04-03 18:45:13 -07:00
Greg Dietsche
2626b83b08 the host keyword in ssh/.config is case insensitive
Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
2013-04-03 18:45:13 -07:00
Kenneth Vestergaard
286bef5eb7 Fix crash when /etc/{fstab,hosts} is unreadable. 2013-02-20 12:30:36 -08:00
David Adam (zanchey)
60435f99b9 fix typo in hostname completion 2012-12-10 01:30:40 +05:30
David Adam (zanchey)
b02ed0bbe6 use sgrep instead of grep 2012-11-27 13:02:13 +08:00
David Adam (zanchey)
165ba535f0 use getent for hosts if available, otherwise use more resilient processing of /etc/hosts 2012-11-27 11:49:52 +08:00
axel
05341b055b ish's current hostname completion uses ~/.ssh/known_hosts as one of its sources of information, but ~/.ssh/config may also be useful. Gather all of the 'Host' declarations from ~/.ssh/config and filter out the ones with wildcards. Signed-off-by: James Vega <jamessan@debian.org>
darcs-hash:20090202210242-ac50b-cf50070ee33ab6113e32a4d997d464ac4b1faf24.gz
2009-02-03 07:02:42 +10:00
axel
f64364cced Replace all internal uses of grep with sgrep, which is a wrapper around grep that strips away any GREP_OPTIONS. This is needed to avoid users who have added arbitrary switches to GREP_OPTIONS, thus changing its behaviour.
darcs-hash:20061129140004-ac50b-485ff6bfd71e9459ba62461f6e093ca5c9ddd664.gz
2006-11-30 00:00:04 +10:00
axel
343cafef34 Redo installation file structure, move lots of things to $PREFIX/share/fish
darcs-hash:20060217101339-ac50b-d93d2c620a4b7f75f05ff461a6edbee001da7613.gz
2006-02-17 20:13:39 +10:00