Class: ClaudeMemory::Commands::CompletionCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/claude_memory/commands/completion_command.rb

Overview

Generates shell completion scripts for bash and zsh. Outputs completion script to stdout for eval or redirection.

Instance Attribute Summary

Attributes inherited from BaseCommand

#stderr, #stdin, #stdout

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize

Constructor Details

This class inherits a constructor from ClaudeMemory::Commands::BaseCommand

Instance Method Details

#call(args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/claude_memory/commands/completion_command.rb', line 8

def call(args)
  opts = parse_options(args, {shell: detect_shell}) do |o|
    OptionParser.new do |parser|
      parser.banner = "Usage: claude-memory completion [options]"
      parser.on("--shell SHELL", %w[bash zsh], "Shell type: bash or zsh (auto-detected)") { |v| o[:shell] = v }
    end
  end
  return 1 if opts.nil?

  case opts[:shell]
  when "zsh"
    stdout.puts zsh_completion
  when "bash"
    stdout.puts bash_completion
  else
    return failure("Unknown shell: #{opts[:shell]}. Use --shell bash or --shell zsh")
  end
  0
end