Class: CredentialsManager::CLI
- Inherits:
-
Object
- Object
- CredentialsManager::CLI
- Includes:
- Commander::Methods
- Defined in:
- lib/credentials_manager/cli.rb
Instance Method Summary collapse
-
#run ⇒ Object
Parses command options and executes actions.
Instance Method Details
#run ⇒ Object
Parses command options and executes actions
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/credentials_manager/cli.rb', line 9 def run program :name, 'CredentialsManager' program :version, ::CredentialsManager::VERSION program :description, 'Manage credentials for fastlane tools.' # Command to add entry to Keychain command :add do |c| c.syntax = 'fastlane-credentials add' c.description = 'Adds a fastlane credential to the keychain.' c.option '--username username', String, 'Username to add.' c.option '--password password', String, 'Password to add.' c.action do |args, | username = .username || ask('Username: ') password = .password || ask('Password: ') { |q| q.echo = '*' } add(username, password) puts "Credential #{username}:#{'*' * password.length} added to keychain." end end # Command to remove credential from Keychain command :remove do |c| c.syntax = 'fastlane-credentials remove' c.description = 'Removes a fastlane credential from the keychain.' c.option '--username username', String, 'Username to remove.' c.action do |args, | username = .username || ask('Username: ') remove(username) end end run! end |