diff options
author | Aaron Gyes <me@aaron.gy> | 2016-04-08 10:46:51 +0800 |
---|---|---|
committer | David Adam <zanchey@ucc.gu.uwa.edu.au> | 2016-04-08 10:49:29 +0800 |
commit | 36691df6fe4667645b71b550ce5eea90762ac23a (patch) | |
tree | ec2d420e797298da5fd83e4ee514f9643b231835 /share/functions/__fish_print_hostnames.fish | |
parent | 790c7f80c7d0fa1c97380885201eb50a2abcce02 (diff) |
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.
Diffstat (limited to 'share/functions/__fish_print_hostnames.fish')
-rw-r--r-- | share/functions/__fish_print_hostnames.fish | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/share/functions/__fish_print_hostnames.fish b/share/functions/__fish_print_hostnames.fish index 38515776..40499d1e 100644 --- a/share/functions/__fish_print_hostnames.fish +++ b/share/functions/__fish_print_hostnames.fish @@ -5,11 +5,11 @@ function __fish_print_hostnames -d "Print a list of known hostnames" # Print all hosts from /etc/hosts if type -q getent # Ignore zero ips - getent hosts | grep -v '^0.0.0.0' \ + getent hosts | string match -r -v '^0.0.0.0' \ | string replace -r '[0-9.]*\s*' '' | string split " " else if test -r /etc/hosts # Ignore commented lines and functionally empty lines - grep -v '^\s*0.0.0.0\|^\s*#\|^\s*$' /etc/hosts \ + string match -r -v '^\s*0.0.0.0|^\s*#|^\s*$' < /etc/hosts \ # Strip comments | string replace -ra '#.*$' '' \ | string replace -r '[0-9.]*\s*' '' | string trim | string replace -ra '\s+' '\n' |