summaryrefslogtreecommitdiffstats
path: root/bin/hostinfo
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2013-06-05 03:29:48 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2013-06-05 19:26:32 +0200
commit957366cd72daf0ca5ffe8d53ce87063ffc9f9b33 (patch)
tree01c6674341b54e377855e09a98a0c92e82c74bfc /bin/hostinfo
parentdaed8ee74bbaf931fd9f8db16ff4fd9a5b24de46 (diff)
downloadtools-957366cd72daf0ca5ffe8d53ce87063ffc9f9b33.tar.gz
tools-957366cd72daf0ca5ffe8d53ce87063ffc9f9b33.tar.bz2
tools-957366cd72daf0ca5ffe8d53ce87063ffc9f9b33.zip
Printer: add force argument to force to print at least an empty entry
If you execute a search with negative matching the result could contain hosts without the field. Under normal circumstances the entry is not printed, because the filter_key does not exists. To get all the matching entries an new force mode is added to print at lease an empty entry.
Diffstat (limited to 'bin/hostinfo')
-rwxr-xr-xbin/hostinfo6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/hostinfo b/bin/hostinfo
index 4a48e2b..0a36f67 100755
--- a/bin/hostinfo
+++ b/bin/hostinfo
@@ -97,12 +97,14 @@ def print_search(basepath, flags, search, filter_key=None):
p = printer.Printer(data, flags)
if filter_key is not None or flags.details:
- p.info(filter_key, label=_get_label(host), maxlength=max(length))
+ p.info(filter_key, label=_get_label(host),
+ maxlength=max(length), force=True)
else:
if key is None:
print(_get_label(host))
else:
- p.info(key, label=_get_label(host), maxlength=max(length))
+ p.info(key, label=_get_label(host),
+ maxlength=max(length), force=True)
def print_info(path, flags, key=None):
data = _get_data(path)