diff options
author | Ian Maddaus <ian.maddaus@progress.com> | 2022-08-11 13:32:17 -0400 |
---|---|---|
committer | Ian Maddaus <ian.maddaus@progress.com> | 2022-11-15 12:37:28 -0500 |
commit | 98a5b647a0d608ee99dd08ebf9d61c2ab183286a (patch) | |
tree | a80d4168c8f7c9c542347e964420ab6926fc451a | |
parent | 03d69806e70b545617f0923dc849c812855b987a (diff) | |
download | chef-98a5b647a0d608ee99dd08ebf9d61c2ab183286a.tar.gz |
Add rake task to output knife common options yaml
Signed-off-by: Ian Maddaus <ian.maddaus@progress.com>
-rw-r--r-- | Rakefile | 1 | ||||
-rw-r--r-- | docs-chef-io/data/knife/common_options.yaml | 104 | ||||
-rw-r--r-- | tasks/knife_docs.rb | 34 |
3 files changed, 139 insertions, 0 deletions
@@ -26,6 +26,7 @@ begin require_relative "tasks/docs" require_relative "tasks/spellcheck" require_relative "chef-utils/lib/chef-utils/dist" unless defined?(ChefUtils::Dist) + require_relative "tasks/knife_docs" rescue LoadError => e puts "Skipping missing rake dep: #{e}" end diff --git a/docs-chef-io/data/knife/common_options.yaml b/docs-chef-io/data/knife/common_options.yaml new file mode 100644 index 0000000000..53ebf837c8 --- /dev/null +++ b/docs-chef-io/data/knife/common_options.yaml @@ -0,0 +1,104 @@ +--- +:chef_server_url: + :short: "-s URL" + :long: "--server-url URL" + :description: Chef Infra Server URL. +:chef_zero_host: + :long: "--chef-zero-host HOST" + :description: Host to start Chef Infra Zero on. +:chef_zero_port: + :long: "--chef-zero-port PORT" + :description: Port (or port range) to start Chef Infra Zero on. Port ranges like + 1000,1010 or 8889-9999 will try all given ports until one works. +:client_key: + :short: "-k KEY" + :long: "--key KEY" + :description: Chef Infra Server API client key. +:color: + :long: "--[no-]color" + :boolean: true + :default: true + :description: Use colored output, defaults to enabled. +:config_file: + :short: "-c CONFIG" + :long: "--config CONFIG" + :description: The configuration file to use. +:config_option: + :long: "--config-option OPTION=VALUE" + :description: Override a single configuration option. +:defaults: + :long: "--defaults" + :description: Accept default values for all questions. +:disable_editing: + :short: "-d" + :long: "--disable-editing" + :description: Do not open EDITOR, just accept the data as is. + :boolean: true + :default: false +:editor: + :short: "-e EDITOR" + :long: "--editor EDITOR" + :description: Set the editor to use for interactive commands. + :default: +:environment: + :short: "-E ENVIRONMENT" + :long: "--environment ENVIRONMENT" + :description: Set the Chef Infra Client environment (except for in searches, where + this will be flagrantly ignored). +:fips: + :long: "--[no-]fips" + :description: Enable FIPS mode. + :boolean: true + :default: +:format: + :short: "-F FORMAT" + :long: "--format FORMAT" + :description: Which format to use for output. + :in: + - summary + - text + - json + - yaml + - pp + :default: summary +:help: + :short: "-h" + :long: "--help" + :description: Show this help message. + :on: :tail + :boolean: true +:listen: + :long: "--[no-]listen" + :description: Whether a local mode (-z) server binds to a port. + :boolean: false +:local_mode: + :short: "-z" + :long: "--local-mode" + :description: Point knife commands at local repository instead of Chef Infra Server. + :boolean: true +:node_name: + :short: "-u USER" + :long: "--user USER" + :description: Chef Infra Server API client username. +:print_after: + :long: "--print-after" + :description: Show the data after a destructive operation. +:profile: + :long: "--profile PROFILE" + :description: The credentials profile to select. +:verbosity: + :short: "-V" + :long: "--verbose" + :description: More verbose output. Use twice (-VV) for additional verbosity and + three times (-VVV) for maximum verbosity. + :default: 0 +:version: + :short: "-v" + :long: "--version" + :description: Show Chef Infra Client version. + :boolean: true + :exit: 0 +:yes: + :short: "-y" + :long: "--yes" + :description: Say yes to all prompts for confirmation. diff --git a/tasks/knife_docs.rb b/tasks/knife_docs.rb new file mode 100644 index 0000000000..16f02cd9d9 --- /dev/null +++ b/tasks/knife_docs.rb @@ -0,0 +1,34 @@ +namespace :knife_docs do + + desc "Generate knife CLI YAML files for documentation on docs.chef.io." + + task :knife do + puts "Generate knife CLI docs files." + + require_relative "../knife/lib/chef/application/knife" + require "fileutils" + require "yaml" + + # Get a hash of common options for all knife commands + common_options = Chef::Application::Knife.options.merge + + # Put the hash in alphabetical order + common_options = common_options.sort.to_h + + # Remove proc from hash if it exists + common_options.each {|_,v| v.delete_if {|key, val| key == :proc}} + + # Output common_options to file + File.open("docs-chef-io/data/knife/common_options.yaml", "w") { |f| f.write(YAML.dump(common_options)) } + + def generate_knife_doc(command) + text = "" + end + + def generate_common_options + test = "" + end + + end + +end |