lib/bolt/bolt_option_parser.rb in bolt-3.20.0 vs lib/bolt/bolt_option_parser.rb in bolt-3.21.0
- old
+ new
@@ -112,10 +112,25 @@
banner: PLUGIN_SHOW_HELP }
else
{ flags: OPTIONS[:global],
banner: PLUGIN_HELP }
end
+ when 'policy'
+ case action
+ when 'apply'
+ { flags: ACTION_OPTS + %w[compile-concurrency hiera-config noop],
+ banner: POLICY_APPLY_HELP }
+ when 'new'
+ { flags: OPTIONS[:global] + PROJECT_PATHS,
+ banner: POLICY_NEW_HELP }
+ when 'show'
+ { flags: OPTIONS[:global] + PROJECT_PATHS,
+ banner: POLICY_SHOW_HELP }
+ else
+ { flags: OPTIONS[:global],
+ banner: POLICY_HELP }
+ end
when 'project'
case action
when 'init'
{ flags: OPTIONS[:global] + %w[modules],
banner: PROJECT_INIT_HELP }
@@ -200,10 +215,11 @@
inventory Show the list of targets an action would run on
module Manage Bolt project modules
lookup Look up a value with Hiera
plan Convert, create, show, and run Bolt plans
plugin Show available plugins
+ policy Apply, create, and show policies
project Create and migrate Bolt projects
script Upload a local script and run it remotely
secret Create encryption keys and encrypt and decrypt values
task Show and run Bolt tasks
@@ -248,11 +264,11 @@
run Run a command on the specified targets.
HELP
COMMAND_RUN_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- run
+ command run
#{colorize(:cyan, 'Usage')}
bolt command run <command> {--targets TARGETS | --query QUERY | --rerun FILTER}
[options]
@@ -284,11 +300,11 @@
upload Upload a local file or directory from the controller
HELP
FILE_DOWNLOAD_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- download
+ file download
#{colorize(:cyan, 'Usage')}
bolt file download <source> <destination> {--targets TARGETS | --query QUERY | --rerun FILTER}
[options]
@@ -307,11 +323,11 @@
bolt file download /etc/ssh_config ssh_config -t all
HELP
FILE_UPLOAD_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- upload
+ file upload
#{colorize(:cyan, 'Usage')}
bolt file upload <source> <destination> {--targets TARGETS | --query QUERY | --rerun FILTER}
[options]
@@ -342,11 +358,11 @@
show Show the list of groups in the inventory
HELP
GROUP_SHOW_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- show
+ group show
#{colorize(:cyan, 'Usage')}
bolt group show [options]
#{colorize(:cyan, 'Description')}
@@ -393,11 +409,11 @@
show Show the list of targets an action would run on
HELP
INVENTORY_SHOW_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- show
+ inventory show
#{colorize(:cyan, 'Usage')}
bolt inventory show [options]
#{colorize(:cyan, 'Description')}
@@ -451,11 +467,11 @@
show List modules available to the Bolt project
HELP
MODULE_ADD_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- add
+ module add
#{colorize(:cyan, 'Usage')}
bolt module add <module> [options]
#{colorize(:cyan, 'Description')}
@@ -469,11 +485,11 @@
To learn more about Bolt modules, run 'bolt guide module'.
HELP
MODULE_GENERATETYPES_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- generate-types
+ module generate-types
#{colorize(:cyan, 'Usage')}
bolt module generate-types [options]
#{colorize(:cyan, 'Description')}
@@ -484,11 +500,11 @@
To learn more about Bolt modules, run 'bolt guide module'.
HELP
MODULE_INSTALL_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- install
+ module install
#{colorize(:cyan, 'Usage')}
bolt module install [options]
#{colorize(:cyan, 'Description')}
@@ -502,11 +518,11 @@
To learn more about Bolt modules, run 'bolt guide module'.
HELP
MODULE_SHOW_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- show
+ module show
#{colorize(:cyan, 'Usage')}
bolt module show [module name] [options]
#{colorize(:cyan, 'Description')}
@@ -539,11 +555,11 @@
show Show available plans and plan documentation
HELP
PLAN_CONVERT_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- convert
+ plan convert
#{colorize(:cyan, 'Usage')}
bolt plan convert <plan name> [options]
#{colorize(:cyan, 'Description')}
@@ -562,11 +578,11 @@
bolt plan convert path/to/plan/myplan.yaml
HELP
PLAN_NEW_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- new
+ plan new
#{colorize(:cyan, 'Usage')}
bolt plan new <plan name> [options]
#{colorize(:cyan, 'Description')}
@@ -579,11 +595,11 @@
bolt plan new myproject::myplan
HELP
PLAN_RUN_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- run
+ plan run
#{colorize(:cyan, 'Usage')}
bolt plan run <plan name> [parameters] [options]
#{colorize(:cyan, 'Description')}
@@ -596,11 +612,11 @@
bolt plan run canary --targets target1,target2 command=hostname
HELP
PLAN_SHOW_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- show
+ plan show
#{colorize(:cyan, 'Usage')}
bolt plan show [plan name] [options]
#{colorize(:cyan, 'Description')}
@@ -639,11 +655,11 @@
show Show available plugins
HELP
PLUGIN_SHOW_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- show
+ plugin show
#{colorize(:cyan, 'Usage')}
bolt plugin show [options]
#{colorize(:cyan, 'Description')}
@@ -651,10 +667,59 @@
#{colorize(:cyan, 'Documentation')}
Learn more about Bolt plugins at https://pup.pt/bolt-plugins.
HELP
+ POLICY_HELP = <<~HELP
+ #{colorize(:cyan, 'Name')}
+ policy
+
+ #{colorize(:cyan, 'Usage')}
+ bolt policy <action> [options]
+
+ #{colorize(:cyan, 'Description')}
+ Apply, create, and show policies.
+
+ #{colorize(:cyan, 'Actions')}
+ apply Apply a policy to the specified targets
+ new Create a new policy in the current project
+ show Show available policy
+ HELP
+
+ POLICY_APPLY_HELP = <<~HELP
+ #{colorize(:cyan, 'Name')}
+ policy apply
+
+ #{colorize(:cyan, 'Usage')}
+ bolt policy apply <policy> [options]
+
+ #{colorize(:cyan, 'Description')}
+ Apply a policy to the specified targets.
+ HELP
+
+ POLICY_NEW_HELP = <<~HELP
+ #{colorize(:cyan, 'Name')}
+ policy new
+
+ #{colorize(:cyan, 'Usage')}
+ bolt policy new <policy> [options]
+
+ #{colorize(:cyan, 'Description')}
+ Create a new policy in the current project.
+ HELP
+
+ POLICY_SHOW_HELP = <<~HELP
+ #{colorize(:cyan, 'Name')}
+ policy show
+
+ #{colorize(:cyan, 'Usage')}
+ bolt policy show [options]
+
+ #{colorize(:cyan, 'Description')}
+ Show available policies.
+ HELP
+
PROJECT_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
project
#{colorize(:cyan, 'Usage')}
@@ -671,11 +736,11 @@
migrate Migrate a Bolt project to the latest version
HELP
PROJECT_INIT_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- init
+ project init
#{colorize(:cyan, 'Usage')}
bolt project init [name] [options]
#{colorize(:cyan, 'Description')}
@@ -695,11 +760,11 @@
bolt project init --modules puppetlabs-apt,puppetlabs-ntp
HELP
PROJECT_MIGRATE_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- migrate
+ project migrate
#{colorize(:cyan, 'Usage')}
bolt project migrate [options]
#{colorize(:cyan, 'Description')}
@@ -727,11 +792,11 @@
run Run a script on the specified targets.
HELP
SCRIPT_RUN_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- run
+ script run
#{colorize(:cyan, 'Usage')}
bolt script run <script> [arguments] {--targets TARGETS | --query QUERY | --rerun FILTER}
[options]
@@ -768,11 +833,11 @@
decrypt Decrypt a value
HELP
SECRET_CREATEKEYS_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- createkeys
+ secret createkeys
#{colorize(:cyan, 'Usage')}
bolt secret createkeys [options]
#{colorize(:cyan, 'Description')}
@@ -782,11 +847,11 @@
Learn more about secrets plugins at http://pup.pt/bolt-plugins.
HELP
SECRET_DECRYPT_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- decrypt
+ secret decrypt
#{colorize(:cyan, 'Usage')}
bolt secret decrypt <ciphertext> [options]
#{colorize(:cyan, 'Description')}
@@ -796,11 +861,11 @@
Learn more about secrets plugins at http://pup.pt/bolt-plugins.
HELP
SECRET_ENCRYPT_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- encrypt
+ secret encrypt
#{colorize(:cyan, 'Usage')}
bolt secret encrypt <plaintext> [options]
#{colorize(:cyan, 'Description')}
@@ -828,11 +893,11 @@
show Show available tasks and task documentation
HELP
TASK_RUN_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- run
+ task run
#{colorize(:cyan, 'Usage')}
bolt task run <task name> [parameters] {--targets TARGETS | --query QUERY | --rerun FILTER}
[options]
@@ -848,10 +913,10 @@
bolt task run package --targets target1,target2 action=status name=bash
HELP
TASK_SHOW_HELP = <<~HELP
#{colorize(:cyan, 'Name')}
- show
+ task show
#{colorize(:cyan, 'Usage')}
bolt task show [task name] [options]
#{colorize(:cyan, 'Description')}