Class: AIHype::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/aihype/cli.rb

Constant Summary collapse

DEFAULT_CONFIG_PATH =
'memory/aihype.md'
DEFAULT_LOG_PATH =
'memory/aihype.log'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv = ARGV) ⇒ CLI



20
21
22
23
24
25
26
27
28
29
# File 'lib/aihype/cli.rb', line 20

def initialize(argv = ARGV)
  @config_path = DEFAULT_CONFIG_PATH
  @log_path = DEFAULT_LOG_PATH
  @verbose = false
  @mode = :pty
  @config_path_specified = false
  @command = nil
  @command_args = []
  parse_options(argv)
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



18
19
20
# File 'lib/aihype/cli.rb', line 18

def command
  @command
end

#command_argsObject (readonly)

Returns the value of attribute command_args.



18
19
20
# File 'lib/aihype/cli.rb', line 18

def command_args
  @command_args
end

#config_pathObject (readonly)

Returns the value of attribute config_path.



18
19
20
# File 'lib/aihype/cli.rb', line 18

def config_path
  @config_path
end

#log_pathObject (readonly)

Returns the value of attribute log_path.



18
19
20
# File 'lib/aihype/cli.rb', line 18

def log_path
  @log_path
end

#modeObject (readonly)

Returns the value of attribute mode.



18
19
20
# File 'lib/aihype/cli.rb', line 18

def mode
  @mode
end

#verboseObject (readonly)

Returns the value of attribute verbose.



18
19
20
# File 'lib/aihype/cli.rb', line 18

def verbose
  @verbose
end

Instance Method Details

#runObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/aihype/cli.rb', line 31

def run
  case @mode
  when :init
    run_init
  when :validate
    run_validate
  when :pty
    run_pty
  else
    raise "Unknown mode: #{@mode}"
  end
end