Skip to content

Conversation

@Traqueur-dev
Copy link
Owner

✨ New Features

  • Hierarchical Command Tree
    Introduced CommandTree<T, S> and CommandNode<T, S> to manage commands in a prefix-tree (trie) structure:

    • Register commands and subcommands by full path (e.g. "parent.child.grandchild")
    • Efficient lookup via findNode(base, rawArgs), which returns the deepest matching node and leftover args
    • Flexible removal (removeCommand(label, prune)) to either clear a single node or prune an entire subtree
  • Improved Default Usage Generation
    Refactored generateDefaultUsage(...) to display only a single level of subcommands alongside required and optional arguments:

    1. Full command path (/parent child …)
    2. Direct subcommands in <sub1|sub2>
    3. Required args <arg> and optional args [opt]

🛠 Changes & Migration Notes

  • Command Tree Replaces Flat Map

    • All command registrations now go through the CommandTree internally.
    • Subcommand lookups and tab-completion should use findNode(...) instead of a flat Map<String, Command>.
  • Usage Format Update

    • Only first-level subcommands are shown in the autogenerated usage string.
    • Tests or custom parsers relying on the old, multi-level usage format may need updating.

Traqueur-dev and others added 3 commits July 8, 2025 10:16
* feat(commands): add command tree to remove complexity

* feat(javadoc); add javadoc for the new element and add test for the new system

* fix: invoker and tabulation with new tree

* fix(tree): fix logic to keep parent command when no child exist

* fix(tree): return the parent command if args is not sub command and parent have command
@Traqueur-dev Traqueur-dev merged commit 20a8125 into master Jul 8, 2025
1 check passed
@Traqueur-dev Traqueur-dev deleted the develop branch July 8, 2025 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant