Skip to content

Commit

Permalink
Merge pull request #77 from DPIclimate/master
Browse files Browse the repository at this point in the history
Add --properties flag to CLI ld ls command
  • Loading branch information
dajtxx authored May 28, 2024
2 parents bb46277 + b9cd3b9 commit 3351865
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/python/broker-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def str_to_dict(val) -> Dict:

## List logical devices
ld_ls_parser = ld_sub_parsers.add_parser('ls', help='list logical devices')
ld_ls_parser.add_argument('--properties', action='store_true', help='Include the properties field in the output', dest='include_props', required=False)

## Create logical devices
ld_mk_parser = ld_sub_parsers.add_parser('create', help='create logical device')
Expand Down Expand Up @@ -294,7 +295,10 @@ def main() -> None:
elif args.cmd1 == 'ld':
if args.cmd2 == 'ls':
devs = dao.get_logical_devices()
tmp_list = list(map(lambda dev: dev.dict(exclude={'properties'}), devs))
if args.include_props:
tmp_list = list(map(lambda dev: dev.dict(), devs))
else:
tmp_list = list(map(lambda dev: dev.dict(exclude={'properties'}), devs))
print(pretty_print_json(tmp_list))
elif args.cmd2 == 'create':
dev = LogicalDevice.parse_obj(dict_from_file_or_string())
Expand Down

0 comments on commit 3351865

Please sign in to comment.