Class: ClaudeMemory::Commands::InitCommand

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

Overview

Initializes ClaudeMemory in a project or globally Delegates to specialized initializer classes for actual setup

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
# File 'lib/claude_memory/commands/init_command.rb', line 8

def call(args)
  opts = parse_options(args, {global: false}) do |o|
    OptionParser.new do |parser|
      parser.on("--global", "Install to global ~/.claude/ settings") { o[:global] = true }
    end
  end
  return 1 if opts.nil?

  initializer = if opts[:global]
    Initializers::GlobalInitializer.new(stdout, stderr, stdin)
  else
    Initializers::ProjectInitializer.new(stdout, stderr, stdin)
  end

  initializer.initialize_memory
end