Module: Ace::Git::Worktree::CLI
- Extended by:
- Support::Cli::RegistryDsl
- Defined in:
- lib/ace/git/worktree/cli.rb,
lib/ace/git/worktree/cli/commands/list.rb,
lib/ace/git/worktree/cli/commands/prune.rb,
lib/ace/git/worktree/cli/commands/config.rb,
lib/ace/git/worktree/cli/commands/create.rb,
lib/ace/git/worktree/cli/commands/remove.rb,
lib/ace/git/worktree/cli/commands/switch.rb,
lib/ace/git/worktree/cli/commands/shared_helpers.rb
Overview
ace-support-cli based CLI registry for ace-git-worktree
- This follows the Hanami pattern with all commands in CLI::Commands
-
namespace.
Defined Under Namespace
Modules: Commands
Constant Summary collapse
- PROGRAM_NAME =
"ace-git-worktree"- REGISTERED_COMMANDS =
[ ["create", "Create a new worktree for task, PR, or branch"], ["list", "List active worktrees with optional task metadata"], ["switch", "Resolve a worktree path for cd navigation"], ["remove", "Remove a worktree by task, branch, or path"], ["prune", "Prune stale/deleted worktree references"], ["config", "Show and validate configuration"] ].freeze
- HELP_EXAMPLES =
[ "ace-git-worktree create --task 148 # Isolated worktree for task", "ace-git-worktree list --show-tasks # Worktrees with task context", "ace-git-worktree switch 148 # Get path for cd", "ace-git-worktree prune --dry-run # Preview stale cleanup" ].freeze
Class Method Summary collapse
-
.start(args) ⇒ Integer
Start the CLI.
-
.wrap_command(command_class) ⇒ Class
Wrap a command to capture its exit code.
Class Method Details
.start(args) ⇒ Integer
Start the CLI.
49 50 51 52 53 |
# File 'lib/ace/git/worktree/cli.rb', line 49 def self.start(args) @captured_exit_code = nil Ace::Support::Cli::Runner.new(self).call(args: args) @captured_exit_code || 0 end |
.wrap_command(command_class) ⇒ Class
Wrap a command to capture its exit code.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ace/git/worktree/cli.rb', line 59 def self.wrap_command(command_class) wrapped = Class.new(Ace::Support::Cli::Command) do define_method(:call) do |**kwargs| result = command_class.new.call(**kwargs) Ace::Git::Worktree::CLI.instance_variable_set(:@captured_exit_code, result) if result.is_a?(Integer) result end end command_class.instance_variables.each do |ivar| wrapped.instance_variable_set(ivar, command_class.instance_variable_get(ivar)) end wrapped end |