From 69fd219da9d4f9d63e1dc4aa07d8473f84b0aa75 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Sun, 17 Feb 2019 17:23:05 +0100 Subject: [PATCH] change list output to be more compact and sorted --- src/materials.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/materials.py b/src/materials.py index 46cf42d..086db2c 100755 --- a/src/materials.py +++ b/src/materials.py @@ -215,12 +215,16 @@ def main(): if args.command == 'list': file_list = read_dir(absolute_path("data"), ["INFO.json", "example.json"], True) + file_list.sort() for filename in file_list: file, _ = os.path.splitext(os.path.basename(filename)) - print(file) data = read_file(filename) data_dict = search_keys(data, ['Name', 'ISO', 'EN-AW', 'WERKSTOFFNUMMER', 'SAE']) - print_dict(data_dict, False, 2) + #print(file) + #print_dict(data_dict, False, 2) + print(file, end='') + aka = [i[0] for i in list(data_dict.values()) if i and file not in i] + print(" (" + ", ".join(aka) + ")") elif args.command == 'get': if args.const_collection: