Move hosts/roles specification to cli args instead of ENV

This commit is contained in:
David Heinemeier Hansson
2023-01-20 16:57:25 +01:00
parent 0388495819
commit 79b5ed179e
13 changed files with 87 additions and 66 deletions

View File

@@ -9,6 +9,9 @@ module Mrsk::Cli
class_option :verbose, type: :boolean, aliases: "-v", desc: "Detailed logging"
class_option :hosts, aliases: "-h", desc: "Run commands on these hosts instead of all (separate by comma)"
class_option :roles, aliases: "-r", desc: "Run commands on these roles instead of all (separate by comma)"
class_option :config_file, aliases: "-c", default: "config/deploy.yml", desc: "Path to config file (default: config/deploy.yml)"
class_option :destination, aliases: "-d", desc: "Specify destination to be used for config file (west -> deploy.west.yml)"
@@ -22,6 +25,8 @@ module Mrsk::Cli
MRSK.tap do |commander|
commander.config_file = Pathname.new(File.expand_path(options[:config_file]))
commander.destination = options[:destination]
commander.hosts = options[:hosts]&.split(",")
commander.roles = options[:roles]&.split(",")
commander.verbose = options[:verbose]
end
end