Class: ClaudeMemory::CLI
- Inherits:
-
Object
- Object
- ClaudeMemory::CLI
- Defined in:
- lib/claude_memory/cli.rb
Overview
Thin command router - dispatches to command classes via Registry
Instance Method Summary collapse
-
#initialize(args = ARGV, stdout: $stdout, stderr: $stderr, stdin: $stdin) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(args = ARGV, stdout: $stdout, stderr: $stderr, stdin: $stdin) ⇒ CLI
Returns a new instance of CLI.
6 7 8 9 10 11 |
# File 'lib/claude_memory/cli.rb', line 6 def initialize(args = ARGV, stdout: $stdout, stderr: $stderr, stdin: $stdin) @args = args @stdout = stdout @stderr = stderr @stdin = stdin end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/claude_memory/cli.rb', line 13 def run command_name = @args.first || "help" command_name = normalize_command(command_name) command_class = Commands::Registry.find(command_name) unless command_class @stderr.puts "Unknown command: #{command_name}" @stderr.puts "Run 'claude-memory help' for usage." return 1 end command = command_class.new(stdout: @stdout, stderr: @stderr, stdin: @stdin) command.call(@args[1..] || []) end |