lib/aptible/cli/agent.rb in aptible-cli-0.14.1 vs lib/aptible/cli/agent.rb in aptible-cli-0.15.0
- old
+ new
@@ -66,11 +66,15 @@
super
end
desc 'version', 'Print Aptible CLI version'
def version
- puts version_string
+ Formatter.render(Renderer.current) do |root|
+ root.keyed_object('version') do |node|
+ node.value('version', version_string)
+ end
+ end
end
desc 'login', 'Log in to Aptible'
option :email
option :password
@@ -109,23 +113,23 @@
raise Thor::Error, 'Could not authenticate with given credentials: ' \
"#{e.code}"
end
save_token(token.access_token)
- puts "Token written to #{token_file}"
+ CLI.logger.info "Token written to #{token_file}"
lifetime_format = { units: 2, joiner: ', ' }
token_lifetime = (token.expires_at - token.created_at).round
expires_in = ChronicDuration.output(token_lifetime, lifetime_format)
- puts "This token will expire after #{expires_in} " \
- '(use --lifetime to customize)'
+ CLI.logger.info "This token will expire after #{expires_in} " \
+ '(use --lifetime to customize)'
end
private
def deprecated(msg)
- $stderr.puts yellow([
+ CLI.logger.warn([
"DEPRECATION NOTICE: #{msg}",
'Please contact support@aptible.com with any questions.'
].join("\n"))
end
@@ -145,10 +149,10 @@
end
now = Time.now.utc.to_i
if last_nag < now - nag_frequency
- $stderr.puts yellow([
+ CLI.logger.warn([
'You have installed the Aptible CLI from source.',
'This is not recommended: some functionality may not work!',
'Review this support topic for more information:',
'https://www.aptible.com/support/topics/cli/how-to-install-cli/'
].join("\n"))