Class: SkillBench::CLI
- Inherits:
-
Object
- Object
- SkillBench::CLI
- Defined in:
- lib/skill_bench/cli.rb
Overview
Thin CLI dispatcher that routes subcommands to their handlers.
Class Method Summary collapse
-
.call(argv) ⇒ Integer
Entry point called from bin/skill-bench.
Instance Method Summary collapse
-
#call ⇒ Integer
Dispatches to the appropriate subcommand handler.
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
25 26 27 |
# File 'lib/skill_bench/cli.rb', line 25 def initialize(argv) @argv = argv end |
Class Method Details
.call(argv) ⇒ Integer
Entry point called from bin/skill-bench.
20 21 22 |
# File 'lib/skill_bench/cli.rb', line 20 def self.call(argv) new(argv).call end |
Instance Method Details
#call ⇒ Integer
Dispatches to the appropriate subcommand handler.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/skill_bench/cli.rb', line 32 def call help = -> { Cli::HelpPrinter.call } return help.call if @argv.empty? subcommand = @argv.shift case subcommand when 'init' then Cli::InitCommand.call(@argv) when 'run' then Cli::RunCommand.call(@argv) when 'skill' then Cli::SkillCommand.call(@argv) when 'eval' then Cli::EvalCommand.call(@argv) when '-h', '--help', 'help' help.call else warn "Unknown subcommand: #{subcommand}" warn "Run 'skill-bench help' for usage." 1 end end |