diff --git a/lib/pact_broker/client/cli/broker.rb b/lib/pact_broker/client/cli/broker.rb index 9eadaeca..a2aa477c 100644 --- a/lib/pact_broker/client/cli/broker.rb +++ b/lib/pact_broker/client/cli/broker.rb @@ -126,6 +126,13 @@ def create_or_update_webhook webhook_url run_webhook_commands webhook_url end + ignored_potential_options_from_environment_variables + desc 'generate-uuid', 'Generate a UUID for use when calling create-or-update-webhook' + def generate_uuid + require 'securerandom' + puts SecureRandom.uuid + end + desc 'version', "Show the pact_broker-client gem version" def version $stdout.puts PactBroker::Client::VERSION diff --git a/lib/pact_broker/client/cli/custom_thor.rb b/lib/pact_broker/client/cli/custom_thor.rb index 5eecd4c1..99358921 100644 --- a/lib/pact_broker/client/cli/custom_thor.rb +++ b/lib/pact_broker/client/cli/custom_thor.rb @@ -65,6 +65,16 @@ def self.turn_muliple_tag_options_into_array argv new_argv.flatten end + # If you try and generate a uuid, and the PACT_BROKER_... env vars are set, it will cause + # generate_uuid to be called with parameters that it doesn't declare, and hence, throw an error. + # This is a dirty hack that stops that happening! + def self.ignored_potential_options_from_environment_variables + method_option :broker_base_url, hide: true + method_option :broker_username, hide: true + method_option :broker_password, hide: true + method_option :broker_token, hide: true + end + def self.shared_options_for_webhook_commands method_option :request, banner: "METHOD", aliases: "-X", desc: "HTTP method", required: true method_option :header, aliases: "-H", type: :array, desc: "Header"