Class: Kettle::Family::CLI

Inherits:
CommandKit::Command
  • Object
show all
Includes:
CommandKit::Commands, ReturningMain
Defined in:
lib/kettle/family/cli.rb

Defined Under Namespace

Modules: CommitOptions, ExecutionOptions, ReturningMain, SelectionOptions, SharedOptions, WorkflowOptions Classes: AddChangelog, BaseCommand, Bex, BranchLanes, BumpVersion, Bup, Bupb, Check, Discover, Docs, GhaShaPins, Install, Lint, Metadata, Plan, Pull, Push, Release, ReleaseState, ReportCommand, StartAt, Template, Test, Up, WorkflowCommand

Constant Summary collapse

COMMANDS =
%w[discover plan report metadata check test lint docs template gha-sha-pins bup bupb bex install bump-version add-changelog release push pull up branch-lanes release-state].freeze
WORKFLOW_COMMANDS =
%w[check test lint docs template gha-sha-pins bup bupb bex release push pull up].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ReturningMain

#main

Class Method Details

.call(argv, out: $stdout, err: $stderr) ⇒ Object



25
26
27
# File 'lib/kettle/family/cli.rb', line 25

def self.call(argv, out: $stdout, err: $stderr)
  main(argv, stdout: out, stderr: err)
end

Instance Method Details

#on_unknown_command(name, _argv = []) ⇒ Object



483
484
485
486
# File 'lib/kettle/family/cli.rb', line 483

def on_unknown_command(name, _argv = [])
  stderr.puts("kettle-family: unknown command #{name.inspect}")
  1
end

#run(command = nil, *argv) ⇒ Object



476
477
478
479
480
481
# File 'lib/kettle/family/cli.rb', line 476

def run(command = nil, *argv)
  return invoke(command, *argv) if command

  help
  0
end

#run_command(command, options) ⇒ Object



488
489
490
491
492
493
494
495
496
# File 'lib/kettle/family/cli.rb', line 488

def run_command(command, options)
  report = build_report(command, options)
  write_report(report, options)
  stdout.puts(options[:json] ? report.to_json : report.to_text)
  report.success? ? 0 : 1
rescue Error, OptionParser::ParseError => error
  stderr.puts("kettle-family: #{error.message}")
  1
end