Class: BWCLI::Config

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/bwcli/config.rb

Overview

Config subcommand

Instance Method Summary collapse

Instance Method Details

#addObject



34
35
36
37
38
39
40
41
42
# File 'lib/bwcli/config.rb', line 34

def add
  conf.add_user options[:e], options[:u], options[:p]

  # Set as current user if no current user exists
  return conf.set_current_user options[:e], options[:u] unless conf.current_user_exists?

  # If current user exists check to switch
  conf.set_current_user options[:e], options[:u] if yes? "Would you like set this user as the current user?"
end

#listObject



26
27
28
# File 'lib/bwcli/config.rb', line 26

def list
  conf.list_users
end

#loginObject



21
22
23
# File 'lib/bwcli/config.rb', line 21

def 
  conf.oauth
end

#removeObject



54
55
56
# File 'lib/bwcli/config.rb', line 54

def remove
  conf.remove_user options[:u], options[:e]
end

#resetObject



59
60
61
# File 'lib/bwcli/config.rb', line 59

def reset
  conf.reset if yes? "Are you sure you want to reset your config?"
end

#setObject



47
48
49
# File 'lib/bwcli/config.rb', line 47

def set
  conf.set_current_user options[:e], options[:u]
end

#userObject



16
17
18
# File 'lib/bwcli/config.rb', line 16

def user
  conf.list_current_user
end