Skip to content

Commit

Permalink
Generate content for verdi code show automatically
Browse files Browse the repository at this point in the history
Some CLI commands like `verdi code show` rely on printing various node
attributes 'by hand' and so may miss certain attributes and must be
maintained 'by hand' on an ongoing basis.

This commit uses `get_cli_options` to populate the output table for the
`show` subcommand automatically, so as to ensure completeness of output
and to simplify future maintenance.
  • Loading branch information
ConradJohnston committed Mar 7, 2023
1 parent 35f95a7 commit d18320a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions aiida/cmdline/commands/cmd_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ def show(code):
table = []
table.append(['PK', code.pk])
table.append(['UUID', code.uuid])
table.append(['Label', code.label])
table.append(['Description', code.description])
table.append(['Default plugin', code.default_calc_job_plugin])
table.append(['Prepend text', code.prepend_text])
table.append(['Append text', code.append_text])

table.append(['Type', code.entry_point.name])
for key in code.get_cli_options().keys():
try:
table.append([key.capitalize().replace('_', ' '), getattr(code, key)])
except AttributeError:
continue
if is_verbose():
table.append(['Calculations', len(code.base.links.get_outgoing().all())])

Expand Down

0 comments on commit d18320a

Please sign in to comment.