diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/hostinfo | 13 |
1 files changed, 9 insertions, 4 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: |