Class: Oc::Run::Info

Inherits:
Base
  • Object
show all
Defined in:
lib/system/run/commands/info.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #options

Instance Method Summary collapse

Methods inherited from Base

description, example, get_object_name, meta, method_added, option, options, summary, syntax

Instance Method Details

#change(*args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/system/run/commands/info.rb', line 10

def change(*args)
  config = Netrc.read("#{(ENV["HOME"] || "./")}/oc.netrc")
  api_key = [(print 'Access Tokens: '), STDIN.gets.rstrip][1]
  client_id = "empty"
  if api_key.empty?
    puts "Please fill all fields".red
  else
    config["api.digitalocean.com"] = api_key, client_id
    config.save
    puts "Informations is changed".red
  end
end

#showObject



5
6
7
# File 'lib/system/run/commands/info.rb', line 5

def show
  puts "Access Tokens: #{Oc::Config.get("api_key")}".yellow
end