Add a -t command for setting the login token
This commit is contained in:
parent
5889c9ceb1
commit
253f0637e5
|
@ -18,6 +18,10 @@ module VagrantPlugins
|
|||
o.on("-k", "--logout", "Logs you out if you're logged in") do |k|
|
||||
options[:logout] = k
|
||||
end
|
||||
|
||||
o.on("-t", "--token TOKEN", String, "Set the Atlas token") do |t|
|
||||
options[:token] = t
|
||||
end
|
||||
end
|
||||
|
||||
# Parse the options
|
||||
|
@ -31,6 +35,8 @@ module VagrantPlugins
|
|||
return execute_check
|
||||
elsif options[:logout]
|
||||
return execute_logout
|
||||
elsif options[:token]
|
||||
return execute_token(options[:token])
|
||||
end
|
||||
|
||||
# Let the user know what is going on.
|
||||
|
@ -78,6 +84,12 @@ module VagrantPlugins
|
|||
@env.ui.success(I18n.t("login_command.logged_out"))
|
||||
return 0
|
||||
end
|
||||
|
||||
def execute_token(token)
|
||||
@client.store_token(token)
|
||||
@env.ui.success(I18n.t("login_command.token_saved"))
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,3 +28,5 @@ en:
|
|||
You are now logged in.
|
||||
logged_out: |-
|
||||
You are logged out.
|
||||
token_saved: |-
|
||||
The token was successfully saved.
|
||||
|
|
Loading…
Reference in New Issue