From 77f8739a4741e2370e40ec39345a92a6ea393a1a Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Tue, 2 Jul 2019 11:11:35 -0700 Subject: fix Layout/AlignArguments this is using: Layout/AlignArguments: Enabled: true EnforcedStyle: with_fixed_indentation the default style can use really excessive whitespace. on starting lines which are already long, it fully indents across to where the arguments start and then begins the line there. Signed-off-by: Lamont Granquist --- lib/chef/knife/bootstrap.rb | 4 ++-- lib/chef/knife/client_bulk_delete.rb | 6 +++--- lib/chef/knife/client_create.rb | 26 +++++++++++++------------- lib/chef/knife/client_delete.rb | 6 +++--- lib/chef/knife/config_get.rb | 16 ++++++++-------- lib/chef/knife/config_list_profiles.rb | 8 ++++---- lib/chef/knife/cookbook_download.rb | 22 +++++++++++----------- lib/chef/knife/cookbook_show.rb | 18 +++++++++--------- lib/chef/knife/core/subcommand_loader.rb | 4 ++-- lib/chef/knife/data_bag_secret_options.rb | 26 +++++++++++++------------- lib/chef/knife/data_bag_show.rb | 4 ++-- lib/chef/knife/environment_from_file.rb | 6 +++--- lib/chef/knife/key_create_base.rb | 24 ++++++++++++------------ lib/chef/knife/key_edit_base.rb | 30 +++++++++++++++--------------- lib/chef/knife/key_list_base.rb | 18 +++++++++--------- lib/chef/knife/supermarket_install.rb | 10 +++++----- 16 files changed, 114 insertions(+), 114 deletions(-) (limited to 'lib/chef/knife') diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index 19384ba768..13f8731c77 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -864,9 +864,9 @@ class Chef # Common configuration for all protocols def base_opts port = config_value(:connection_port, - knife_key_for_protocol(connection_protocol, :port)) + knife_key_for_protocol(connection_protocol, :port)) user = config_value(:connection_user, - knife_key_for_protocol(connection_protocol, :user)) + knife_key_for_protocol(connection_protocol, :user)) {}.tap do |opts| opts[:logger] = Chef::Log # We do not store password in Chef::Config, so only use CLI `config` here diff --git a/lib/chef/knife/client_bulk_delete.rb b/lib/chef/knife/client_bulk_delete.rb index 28278eb89c..703ccb7747 100644 --- a/lib/chef/knife/client_bulk_delete.rb +++ b/lib/chef/knife/client_bulk_delete.rb @@ -27,9 +27,9 @@ class Chef end option :delete_validators, - short: "-D", - long: "--delete-validators", - description: "Force deletion of clients if they're validators." + short: "-D", + long: "--delete-validators", + description: "Force deletion of clients if they're validators." banner "knife client bulk delete REGEX (options)" diff --git a/lib/chef/knife/client_create.rb b/lib/chef/knife/client_create.rb index 05aafd446e..32ee846d52 100644 --- a/lib/chef/knife/client_create.rb +++ b/lib/chef/knife/client_create.rb @@ -28,25 +28,25 @@ class Chef end option :file, - short: "-f FILE", - long: "--file FILE", - description: "Write the private key to a file if the #{Chef::Dist::SERVER_PRODUCT} generated one." + short: "-f FILE", + long: "--file FILE", + description: "Write the private key to a file if the #{Chef::Dist::SERVER_PRODUCT} generated one." option :validator, - long: "--validator", - description: "Create the client as a validator.", - boolean: true + long: "--validator", + description: "Create the client as a validator.", + boolean: true option :public_key, - short: "-p FILE", - long: "--public-key", - description: "Set the initial default key for the client from a file on disk (cannot pass with --prevent-keygen)." + short: "-p FILE", + long: "--public-key", + description: "Set the initial default key for the client from a file on disk (cannot pass with --prevent-keygen)." option :prevent_keygen, - short: "-k", - long: "--prevent-keygen", - description: "Prevent #{Chef::Dist::SERVER_PRODUCT} from generating a default key pair for you. Cannot be passed with --public-key.", - boolean: true + short: "-k", + long: "--prevent-keygen", + description: "Prevent #{Chef::Dist::SERVER_PRODUCT} from generating a default key pair for you. Cannot be passed with --public-key.", + boolean: true banner "knife client create CLIENTNAME (options)" diff --git a/lib/chef/knife/client_delete.rb b/lib/chef/knife/client_delete.rb index 23f34e65b4..bd3331f7db 100644 --- a/lib/chef/knife/client_delete.rb +++ b/lib/chef/knife/client_delete.rb @@ -27,9 +27,9 @@ class Chef end option :delete_validators, - short: "-D", - long: "--delete-validators", - description: "Force deletion of client if it's a validator." + short: "-D", + long: "--delete-validators", + description: "Force deletion of client if it's a validator." banner "knife client delete [CLIENT [CLIENT]] (options)" diff --git a/lib/chef/knife/config_get.rb b/lib/chef/knife/config_get.rb index f21033d793..b07bef9a36 100644 --- a/lib/chef/knife/config_get.rb +++ b/lib/chef/knife/config_get.rb @@ -25,16 +25,16 @@ class Chef banner "knife config get [OPTION...] (options)\nDisplays the value of Chef::Config[OPTION] (or all config values)" option :all, - short: "-a", - long: "--all", - description: "Include options that are not set in the configuration.", - default: false + short: "-a", + long: "--all", + description: "Include options that are not set in the configuration.", + default: false option :raw, - short: "-r", - long: "--raw", - description: "Display a each value with no formatting.", - default: false + short: "-r", + long: "--raw", + description: "Display a each value with no formatting.", + default: false def run if config[:format] == "summary" && !config[:raw] diff --git a/lib/chef/knife/config_list_profiles.rb b/lib/chef/knife/config_list_profiles.rb index 29e3e24dc5..fb40b30b0a 100644 --- a/lib/chef/knife/config_list_profiles.rb +++ b/lib/chef/knife/config_list_profiles.rb @@ -24,10 +24,10 @@ class Chef banner "knife config list-profiles (options)" option :ignore_knife_rb, - short: "-i", - long: "--ignore-knife-rb", - description: "Ignore the current config.rb/knife.rb configuration.", - default: false + short: "-i", + long: "--ignore-knife-rb", + description: "Ignore the current config.rb/knife.rb configuration.", + default: false def run credentials_data = self.class.config_loader.parse_credentials_file diff --git a/lib/chef/knife/cookbook_download.rb b/lib/chef/knife/cookbook_download.rb index 09f420ffe5..2da5e138a3 100644 --- a/lib/chef/knife/cookbook_download.rb +++ b/lib/chef/knife/cookbook_download.rb @@ -33,21 +33,21 @@ class Chef banner "knife cookbook download COOKBOOK [VERSION] (options)" option :latest, - short: "-N", - long: "--latest", - description: "The version of the cookbook to download.", - boolean: true + short: "-N", + long: "--latest", + description: "The version of the cookbook to download.", + boolean: true option :download_directory, - short: "-d DOWNLOAD_DIRECTORY", - long: "--dir DOWNLOAD_DIRECTORY", - description: "The directory to download the cookbook into.", - default: Dir.pwd + short: "-d DOWNLOAD_DIRECTORY", + long: "--dir DOWNLOAD_DIRECTORY", + description: "The directory to download the cookbook into.", + default: Dir.pwd option :force, - short: "-f", - long: "--force", - description: "Force download over the download directory if it exists." + short: "-f", + long: "--force", + description: "Force download over the download directory if it exists." # TODO: tim/cw: 5-23-2010: need to implement knife-side # specificity for downloads - need to implement --platform and diff --git a/lib/chef/knife/cookbook_show.rb b/lib/chef/knife/cookbook_show.rb index 9129e61e7e..d1e7220650 100644 --- a/lib/chef/knife/cookbook_show.rb +++ b/lib/chef/knife/cookbook_show.rb @@ -31,19 +31,19 @@ class Chef banner "knife cookbook show COOKBOOK [VERSION] [PART] [FILENAME] (options)" option :fqdn, - short: "-f FQDN", - long: "--fqdn FQDN", - description: "The FQDN of the host to see the file for." + short: "-f FQDN", + long: "--fqdn FQDN", + description: "The FQDN of the host to see the file for." option :platform, - short: "-p PLATFORM", - long: "--platform PLATFORM", - description: "The platform to see the file for." + short: "-p PLATFORM", + long: "--platform PLATFORM", + description: "The platform to see the file for." option :platform_version, - short: "-V VERSION", - long: "--platform-version VERSION", - description: "The platform version to see the file for." + short: "-V VERSION", + long: "--platform-version VERSION", + description: "The platform version to see the file for." option :with_uri, short: "-w", diff --git a/lib/chef/knife/core/subcommand_loader.rb b/lib/chef/knife/core/subcommand_loader.rb index bb84c55dd9..f2dc06ce36 100644 --- a/lib/chef/knife/core/subcommand_loader.rb +++ b/lib/chef/knife/core/subcommand_loader.rb @@ -108,7 +108,7 @@ class Chef cmd_words = positional_arguments(args) load_command(cmd_words) result = Chef::Knife.subcommands[find_longest_key(Chef::Knife.subcommands, - cmd_words, "_")] + cmd_words, "_")] result || Chef::Knife.subcommands[args.first.tr("-", "_")] end @@ -116,7 +116,7 @@ class Chef category_words = positional_arguments(args) category_words.map! { |w| w.split("-") }.flatten! find_longest_key(Chef::Knife.subcommands_by_category, - category_words, " ") + category_words, " ") end # diff --git a/lib/chef/knife/data_bag_secret_options.rb b/lib/chef/knife/data_bag_secret_options.rb index d04be7d448..4b4cb8a7e1 100644 --- a/lib/chef/knife/data_bag_secret_options.rb +++ b/lib/chef/knife/data_bag_secret_options.rb @@ -35,23 +35,23 @@ class Chef def self.included(base) base.option :secret, - short: "-s SECRET", - long: "--secret ", - description: "The secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret'.", - # Need to store value from command line in separate variable - knife#merge_configs populates same keys - # on config object from - proc: Proc.new { |s| set_cl_secret(s) } + short: "-s SECRET", + long: "--secret ", + description: "The secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret'.", + # Need to store value from command line in separate variable - knife#merge_configs populates same keys + # on config object from + proc: Proc.new { |s| set_cl_secret(s) } base.option :secret_file, - long: "--secret-file SECRET_FILE", - description: "A file containing the secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret_file'.", - proc: Proc.new { |sf| set_cl_secret_file(sf) } + long: "--secret-file SECRET_FILE", + description: "A file containing the secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret_file'.", + proc: Proc.new { |sf| set_cl_secret_file(sf) } base.option :encrypt, - long: "--encrypt", - description: "If 'secret' or 'secret_file' is present in your config, then encrypt data bags using it.", - boolean: true, - default: false + long: "--encrypt", + description: "If 'secret' or 'secret_file' is present in your config, then encrypt data bags using it.", + boolean: true, + default: false end def encryption_secret_provided? diff --git a/lib/chef/knife/data_bag_show.rb b/lib/chef/knife/data_bag_show.rb index 529b0fafcf..aad94745dc 100644 --- a/lib/chef/knife/data_bag_show.rb +++ b/lib/chef/knife/data_bag_show.rb @@ -44,8 +44,8 @@ class Chef # Users do not need to pass --encrypt to read data, we simply try to use the provided secret ui.info("Encrypted data bag detected, decrypting with provided secret.") raw = Chef::EncryptedDataBagItem.load(@name_args[0], - @name_args[1], - secret) + @name_args[1], + secret) format_for_display(raw.to_h) elsif encrypted && !secret ui.warn("Encrypted data bag detected, but no secret provided for decoding. Displaying encrypted data.") diff --git a/lib/chef/knife/environment_from_file.rb b/lib/chef/knife/environment_from_file.rb index 3d476a4712..2ab3e1e670 100644 --- a/lib/chef/knife/environment_from_file.rb +++ b/lib/chef/knife/environment_from_file.rb @@ -30,9 +30,9 @@ class Chef banner "knife environment from file FILE [FILE..] (options)" option :all, - short: "-a", - long: "--all", - description: "Upload all environments." + short: "-a", + long: "--all", + description: "Upload all environments." def loader @loader ||= Knife::Core::ObjectLoader.new(Chef::Environment, ui) diff --git a/lib/chef/knife/key_create_base.rb b/lib/chef/knife/key_create_base.rb index d69f442e71..81630f584a 100644 --- a/lib/chef/knife/key_create_base.rb +++ b/lib/chef/knife/key_create_base.rb @@ -25,24 +25,24 @@ class Chef def self.included(includer) includer.class_eval do option :public_key, - short: "-p FILENAME", - long: "--public-key FILENAME", - description: "Public key for newly created key. If not passed, the server will create a key pair for you, but you must pass --key-name NAME in that case." + short: "-p FILENAME", + long: "--public-key FILENAME", + description: "Public key for newly created key. If not passed, the server will create a key pair for you, but you must pass --key-name NAME in that case." option :file, - short: "-f FILE", - long: "--file FILE", - description: "Write the private key to a file, if you requested the server to create one." + short: "-f FILE", + long: "--file FILE", + description: "Write the private key to a file, if you requested the server to create one." option :key_name, - short: "-k NAME", - long: "--key-name NAME", - description: "The name for your key. If you do not pass a name, you must pass --public-key, and the name will default to the fingerprint of the public key passed." + short: "-k NAME", + long: "--key-name NAME", + description: "The name for your key. If you do not pass a name, you must pass --public-key, and the name will default to the fingerprint of the public key passed." option :expiration_date, - short: "-e DATE", - long: "--expiration-date DATE", - description: "Optionally pass the expiration date for the key in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z. Defaults to infinity if not passed. UTC timezone assumed." + short: "-e DATE", + long: "--expiration-date DATE", + description: "Optionally pass the expiration date for the key in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z. Defaults to infinity if not passed. UTC timezone assumed." end end end diff --git a/lib/chef/knife/key_edit_base.rb b/lib/chef/knife/key_edit_base.rb index ecdb4b0038..df3529b7db 100644 --- a/lib/chef/knife/key_edit_base.rb +++ b/lib/chef/knife/key_edit_base.rb @@ -25,29 +25,29 @@ class Chef def self.included(includer) includer.class_eval do option :public_key, - short: "-p FILENAME", - long: "--public-key FILENAME", - description: "Replace the public_key field from a file on disk. If not passed, the public_key field will not change." + short: "-p FILENAME", + long: "--public-key FILENAME", + description: "Replace the public_key field from a file on disk. If not passed, the public_key field will not change." option :create_key, - short: "-c", - long: "--create-key", - description: "Replace the public_key field with a key generated by the server. The private key will be returned." + short: "-c", + long: "--create-key", + description: "Replace the public_key field with a key generated by the server. The private key will be returned." option :file, - short: "-f FILE", - long: "--file FILE", - description: "Write the private key to a file, if you requested the server to create one via --create-key." + short: "-f FILE", + long: "--file FILE", + description: "Write the private key to a file, if you requested the server to create one via --create-key." option :key_name, - short: "-k NAME", - long: "--key-name NAME", - description: "The new name for your key. Pass if you wish to update the name field of your key." + short: "-k NAME", + long: "--key-name NAME", + description: "The new name for your key. Pass if you wish to update the name field of your key." option :expiration_date, - short: "-e DATE", - long: "--expiration-date DATE", - description: "Updates the expiration_date field of your key if passed. Pass in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z or infinity. UTC timezone assumed." + short: "-e DATE", + long: "--expiration-date DATE", + description: "Updates the expiration_date field of your key if passed. Pass in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z or infinity. UTC timezone assumed." end end end diff --git a/lib/chef/knife/key_list_base.rb b/lib/chef/knife/key_list_base.rb index 6470bf78ad..fb9db65103 100644 --- a/lib/chef/knife/key_list_base.rb +++ b/lib/chef/knife/key_list_base.rb @@ -25,19 +25,19 @@ class Chef def self.included(includer) includer.class_eval do option :with_details, - short: "-w", - long: "--with-details", - description: "Show corresponding URIs and whether the key has expired or not." + short: "-w", + long: "--with-details", + description: "Show corresponding URIs and whether the key has expired or not." option :only_expired, - short: "-e", - long: "--only-expired", - description: "Only show expired keys." + short: "-e", + long: "--only-expired", + description: "Only show expired keys." option :only_non_expired, - short: "-n", - long: "--only-non-expired", - description: "Only show non-expired keys." + short: "-n", + long: "--only-non-expired", + description: "Only show non-expired keys." end end end diff --git a/lib/chef/knife/supermarket_install.rb b/lib/chef/knife/supermarket_install.rb index f47917e13d..b0b8fbe1aa 100644 --- a/lib/chef/knife/supermarket_install.rb +++ b/lib/chef/knife/supermarket_install.rb @@ -34,11 +34,11 @@ class Chef category "supermarket" option :no_deps, - short: "-D", - long: "--skip-dependencies", - boolean: true, - default: false, - description: "Skips automatic dependency installation." + short: "-D", + long: "--skip-dependencies", + boolean: true, + default: false, + description: "Skips automatic dependency installation." option :cookbook_path, short: "-o PATH:PATH", -- cgit v1.2.1