diff --git a/examples/.metaforce.yml b/examples/.metaforce.yml index 6a5773f..5602283 100644 --- a/examples/.metaforce.yml +++ b/examples/.metaforce.yml @@ -1,4 +1,6 @@ # This is purely an example. +# It is a good practice to leave passwords empty in this file and manually type it when prompted. +# Your password will NOT be shown in console while typing. --- production: username: foo@bar.com diff --git a/lib/metaforce/cli.rb b/lib/metaforce/cli.rb index b2e99c0..73160b9 100644 --- a/lib/metaforce/cli.rb +++ b/lib/metaforce/cli.rb @@ -107,7 +107,11 @@ def client credentials.merge!(options.slice(:username, :password, :security_token, :host)) credentials.tap do |credentials| credentials[:username] ||= ask('username:') - credentials[:password] ||= ask('password:') + if credentials[:password].nil? + print("password: ") + credentials[:password] = STDIN.noecho(&:gets).chomp + puts(); + end credentials[:security_token] ||= ask('security token:') end Metaforce.configuration.host = credentials[:host]