Class: Henitai::CLI

Inherits:
Object
  • Object
show all
Includes:
CleanCommand, CommandSupport, InitCommand, OperatorCommand, Options, RunCommand
Defined in:
lib/henitai/cli.rb,
lib/henitai/cli/options.rb,
lib/henitai/cli/run_command.rb,
lib/henitai/cli/init_command.rb,
lib/henitai/cli/clean_command.rb,
lib/henitai/cli/command_support.rb,
lib/henitai/cli/operator_command.rb

Overview

Command-line interface entry point.

Usage:

henitai run [options] [SUBJECT_PATTERN...]

Options:

--since GIT_REF   Only mutate subjects changed since GIT_REF
--use INTEGRATION Override integration from config (e.g. rspec)
--config PATH     Path to .henitai.yml (default: .henitai.yml)
--operators SET   Operator set: light (default) | full
--jobs N          Number of parallel workers (default: 1)
--all-logs        Print all captured child logs
-h, --help        Show this help message
-v, --version     Show version

Argument parsing and command dispatch live here; the per-command behaviour lives in the mixed-in command modules under lib/henitai/cli/.

Defined Under Namespace

Modules: CleanCommand, CommandSupport, InitCommand, OperatorCommand, Options, RunCommand

Constant Summary collapse

REPORT_CLEANUP_PATHS =
[
  %w[mutation-logs baseline.log],
  %w[mutation-logs baseline.stdout.log],
  %w[mutation-logs baseline.stderr.log],
  %w[coverage .resultset.json],
  %w[coverage .last_run.json],
  ["henitai_per_test.json"]
].freeze

Constants included from OperatorCommand

OperatorCommand::OPERATOR_METADATA

Constants included from InitCommand

InitCommand::INIT_TEMPLATE_LINES

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



49
50
51
# File 'lib/henitai/cli.rb', line 49

def initialize(argv)
  @argv = argv.dup
end

Class Method Details

.start(argv) ⇒ Object



45
46
47
# File 'lib/henitai/cli.rb', line 45

def self.start(argv)
  new(argv).run
end

Instance Method Details

#runObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/henitai/cli.rb', line 53

def run
  command = @argv.shift
  case command
  when "run"     then run_command
  when "clean"   then clean_command
  when "version" then puts Henitai::VERSION
  when "init"    then init_command
  when "operator" then operator_command
  when nil, "-h", "--help" then puts help_text
  else
    warn "Unknown command: #{command}"
    warn help_text
    exit 1
  end
end