Class: Ace::Git::Worktree::Commands::ListCommand
- Inherits:
-
Object
- Object
- Ace::Git::Worktree::Commands::ListCommand
- Defined in:
- lib/ace/git/worktree/commands/list_command.rb
Overview
List command
Lists worktrees with various formatting and filtering options. Supports task-aware listing and search capabilities.
Instance Method Summary collapse
-
#initialize ⇒ ListCommand
constructor
Initialize a new ListCommand.
-
#run(args = []) ⇒ Integer
Run the list command.
-
#show_help ⇒ Integer
Show help for the list command.
Constructor Details
#initialize ⇒ ListCommand
Initialize a new ListCommand
22 23 24 |
# File 'lib/ace/git/worktree/commands/list_command.rb', line 22 def initialize @manager = Organisms::WorktreeManager.new end |
Instance Method Details
#run(args = []) ⇒ Integer
Run the list command
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ace/git/worktree/commands/list_command.rb', line 30 def run(args = []) = parse_arguments(args) return show_help if [:help] () # Convert format to symbol for WorktreeLister compatibility [:format] = [:format].to_sym if [:format] result = @manager.list_all() if result[:success] display_list_result(result, ) 0 else puts "Failed to list worktrees: #{result[:error]}" 1 end rescue ArgumentError => e puts "Error: #{e.}" puts show_help 1 rescue => e puts "Error: #{e.}" 1 end |
#show_help ⇒ Integer
Show help for the list command
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/ace/git/worktree/commands/list_command.rb', line 61 def show_help puts <<~HELP ace-git-worktree list - List worktrees USAGE: ace-git-worktree list [OPTIONS] OUTPUT FORMATS: --format <format> Output format: table, json, simple (default: table) --show-tasks Include task associations FILTERING: --task-associated Show only task-associated worktrees --no-task-associated Show only non-task worktrees --usable Show only usable worktrees --no-usable Show only unusable worktrees --search <pattern> Filter by branch name pattern EXAMPLES: # List all worktrees in table format ace-git-worktree list # List with task associations in JSON format ace-git-worktree list --show-tasks --format json # List only task-associated worktrees ace-git-worktree list --task-associated # Search for worktrees with "auth" in branch name ace-git-worktree list --search auth # List only usable worktrees ace-git-worktree list --usable OUTPUT: Table format columns: - Task: Task ID (or - for non-task worktrees) - Branch: Git branch name - Path: Worktree directory path - Status: worktree status (task, normal, bare, detached, etc.) JSON format includes full worktree details and metadata. HELP 0 end |