Fix failure to pass on class options to subcommands
This commit is contained in:
@@ -27,7 +27,7 @@ module Mrsk::Cli
|
||||
def initialize(*)
|
||||
super
|
||||
load_envs
|
||||
initialize_commander(options)
|
||||
initialize_commander(options_with_subcommand_class_options)
|
||||
end
|
||||
|
||||
private
|
||||
@@ -39,6 +39,10 @@ module Mrsk::Cli
|
||||
end
|
||||
end
|
||||
|
||||
def options_with_subcommand_class_options
|
||||
options.merge(@_initializer.last[:class_options] || {})
|
||||
end
|
||||
|
||||
def initialize_commander(options)
|
||||
MRSK.tap do |commander|
|
||||
if options[:verbose]
|
||||
|
||||
@@ -121,6 +121,13 @@ class CliAppTest < CliTestCase
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test "version through main" do
|
||||
stdouted { Mrsk::Cli::Main.start(["app", "version", "-c", "test/fixtures/deploy_with_accessories.yml", "--hosts", "1.1.1.1"]) }.tap do |output|
|
||||
assert_match "docker ps --filter label=service=app --format \"{{.Names}}\" | sed 's/-/\\n/g' | tail -n 1", output
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def run_command(*command)
|
||||
stdouted { Mrsk::Cli::App.start([*command, "-c", "test/fixtures/deploy_with_accessories.yml", "--hosts", "1.1.1.1"]) }
|
||||
|
||||
Reference in New Issue
Block a user