summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2013-05-17 15:30:52 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2013-05-17 15:39:44 +0200
commit27436f8b8a84fa70bba3a7b7d286fd3eba37fbfe (patch)
treeff12eeb60b4ade2b56cf6b485712ff3c26e81f4a /contrib
parent6c33ef52d422cfe2b924d9e1da16266159b5d3b2 (diff)
downloadtools-27436f8b8a84fa70bba3a7b7d286fd3eba37fbfe.tar.gz
tools-27436f8b8a84fa70bba3a7b7d286fd3eba37fbfe.tar.bz2
tools-27436f8b8a84fa70bba3a7b7d286fd3eba37fbfe.zip
bin/hostinfo: add support for --hosts and --short
You could now use --hosts to get a listing of all available hosts with in the current basepath (set by HOSTINFO_PATH or --path or the default value /usr/local/share/hostinfo/). If you use --short you will remove the domain spline.inf.fu-berlin.de from the output and you will get only the hostnames.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/bash-completion5
1 files changed, 2 insertions, 3 deletions
diff --git a/contrib/bash-completion b/contrib/bash-completion
index 1adad22..0994d39 100644
--- a/contrib/bash-completion
+++ b/contrib/bash-completion
@@ -1,7 +1,5 @@
# hostinfo completion
-_hostinfo_hosts="$(for file in /usr/local/share/hostinfo/* ; do basename $file | sed 's/.spline.inf.fu-berlin.de//' ; done)"
-
_get_first_hostinfo_arg()
{
local i
@@ -30,6 +28,7 @@ _get_hostinfo_path()
done
}
+
_hostinfo() {
local cur prev
@@ -43,7 +42,7 @@ _hostinfo() {
_get_first_hostinfo_arg
_get_hostinfo_path
if [[ -z "$arg" ]]; then
- _completion="$_hostinfo_hosts"
+ _completion="$(hostinfo $path --hosts --short 2>/dev/null)"
else
_completion="$(hostinfo $path --keys $arg 2>/dev/null)"
fi