lib/uffizzi/cli/config.rb in uffizzi-cli-1.0.5 vs lib/uffizzi/cli/config.rb in uffizzi-cli-2.0.27
- old
+ new
@@ -3,10 +3,11 @@
require 'uffizzi'
require 'uffizzi/clients/api/api_client'
module Uffizzi
class Cli::Config < Thor
+ ACCOUNT_PROPERTY = 'account'
include ApiClient
desc 'list', 'Lists all options and their values from the config file'
def list
run('list')
@@ -55,16 +56,14 @@
def handle_setup_command
Uffizzi.ui.say("Configure the default properties that will be used to authenticate with your \
\nUffizzi API service and manage previews.\n")
server = Uffizzi.ui.ask('Server: ', default: Uffizzi.configuration.default_server.to_s)
- username = Uffizzi.ui.ask('Username: ')
- project = Uffizzi.ui.ask('Project: ', default: 'default')
+
ConfigFile.delete
ConfigFile.write_option(:server, server)
- ConfigFile.write_option(:username, username)
- ConfigFile.write_option(:project, project)
+
Uffizzi.ui.say('To login, run: uffizzi login')
end
def handle_list_command
ConfigFile.list
@@ -76,9 +75,11 @@
Uffizzi.ui.say(message)
end
def handle_set_command(property, value)
+ return handle_set_account(value) if property == ACCOUNT_PROPERTY
+
ConfigFile.write_option(property.to_sym, value)
Uffizzi.ui.say("Updated property [#{property}]")
end
def handle_unset_command(property)