From bfc5cf328b715983ed91eefd8649368a040f0864 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Mon, 8 Sep 2025 21:16:20 +0100 Subject: [PATCH] Fix tools --- trustgraph-cli/trustgraph/cli/set_tool.py | 8 +++---- trustgraph-cli/trustgraph/cli/show_tools.py | 23 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/trustgraph-cli/trustgraph/cli/set_tool.py b/trustgraph-cli/trustgraph/cli/set_tool.py index 43370527..b5803549 100644 --- a/trustgraph-cli/trustgraph/cli/set_tool.py +++ b/trustgraph-cli/trustgraph/cli/set_tool.py @@ -97,11 +97,11 @@ def set_tool( for a in arguments ] - if group: object["group"] = group + if group is not None: object["group"] = group if state: object["state"] = state - if applicable_states: object["applicable-states"] = applicable_states + if applicable_states is not None: object["applicable-states"] = applicable_states values = api.put([ ConfigValue( @@ -254,9 +254,9 @@ def main(): collection=args.collection, template=args.template, arguments=arguments, - group=args.group or [], + group=args.group, state=args.state, - applicable_states=getattr(args, 'applicable_states', None) or [], + applicable_states=args.applicable_states, ) except Exception as e: diff --git a/trustgraph-cli/trustgraph/cli/show_tools.py b/trustgraph-cli/trustgraph/cli/show_tools.py index 6d656fa2..ce79fffc 100644 --- a/trustgraph-cli/trustgraph/cli/show_tools.py +++ b/trustgraph-cli/trustgraph/cli/show_tools.py @@ -52,6 +52,29 @@ def show_config(url): f"arg {n}", f"{arg['name']}: {arg['type']}\n{arg['description']}" )) + + # Display group information + if "group" in data: + groups = data["group"] + if groups: + table.append(("groups", ", ".join(groups))) + else: + table.append(("groups", "(empty - no groups)")) + + # Display state transition information + if "state" in data: + table.append(("next state", data["state"])) + + # Display applicable states + if "applicable-states" in data: + states = data["applicable-states"] + if states: + if "*" in states: + table.append(("available in", "all states")) + else: + table.append(("available in", ", ".join(states))) + else: + table.append(("available in", "(empty - never available)")) print()