Class: Evilution::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(argv, stdin: $stdin) ⇒ CLI

Returns a new instance of CLI.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/evilution/cli.rb', line 11

def initialize(argv, stdin: $stdin)
  @options = {}
  @command = :run
  @stdin = stdin
  argv = argv.dup
  argv = extract_command(argv)
  argv = preprocess_flags(argv)
  raw_args = build_option_parser.parse!(argv)
  @files, @line_ranges = parse_file_args(raw_args)
  read_stdin_files if @options.delete(:stdin) && @command == :run
end

Instance Method Details

#callObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/evilution/cli.rb', line 23

def call
  case @command
  when :version
    $stdout.puts(VERSION)
    0
  when :init
    run_init
  when :mcp
    run_mcp
  when :run
    run_mutations
  end
end