summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/hostinfo13
-rw-r--r--contrib/bash-completion2
2 files changed, 10 insertions, 5 deletions
diff --git a/bin/hostinfo b/bin/hostinfo
index 98c2162..0a65443 100755
--- a/bin/hostinfo
+++ b/bin/hostinfo
@@ -94,11 +94,14 @@ def print_search(basepath, flags, search):
print(_get_label(host))
continue
- if key is None:
- print(_get_label(host))
+ p = printer.Printer(data, flags)
+ if flags.details:
+ p.info(None, label=_get_label(host), maxlength=max(length))
else:
- p = printer.Printer(data, flags)
- p.info(key, label=_get_label(host), maxlength=max(length))
+ if key is None:
+ print(_get_label(host))
+ else:
+ p.info(key, label=_get_label(host), maxlength=max(length))
def print_info(path, flags, key=None):
data = _get_data(path)
@@ -198,6 +201,8 @@ def main():
help="remove the domain from the output")
parser.add_argument("--only-names", action="store_true",
help="only print the hostname of the matching entries")
+ parser.add_argument("-d", "--details", action="store_true",
+ help="print details about matching hosts")
args = parser.parse_args()
if args.path:
diff --git a/contrib/bash-completion b/contrib/bash-completion
index 333bf0e..4d64f08 100644
--- a/contrib/bash-completion
+++ b/contrib/bash-completion
@@ -49,7 +49,7 @@ _hostinfo() {
COMPREPLY=( $( compgen -W "-o --oneline -f --file -k --keys -h -? --help
-p --path -n --nospaces -l --hosts -s --short
- -v --verbose --only-names
+ -v --verbose --only-names -d --details
$_completion" -- $cur ) )
fi
}