class Keystorage::CLI
Attributes
global_options[R]
Public Class Methods
global_option(*params)
click to toggle source
# File lib/keystorage/cli.rb, line 33 def global_option *params @global_options ||= {} @global_options[params[0]] = params[1] class_option params[0],params[1] end
start(given_args = ARGV, config = {})
click to toggle source
Calls superclass method
# File lib/keystorage/cli.rb, line 13 def start(given_args = ARGV, config = {}) # parse global options: Thor is not support global-options. # Like: command global-options subcommand options new_global_options = [] OptionParser.new do |opt| @global_options.each { |name,config| case config[:type] when :boolean then opt.on(config[:aliases],"--#{name.to_s}") { |v| new_global_options << "--#{name.to_s}"} when :string then opt.on(config[:aliases],"--#{name.to_s}=VALUE") { |v| new_global_options << "--#{name.to_s}=#{v}"} end } opt.parse!(given_args) end given_args+=new_global_options super(given_args,config) end
Public Instance Methods
exec(*command)
click to toggle source
# File lib/keystorage/cli.rb, line 73 def exec *command #@todo: ask if new_secret == nil Manager.new(options).exec(command) end
get(group,key)
click to toggle source
# File lib/keystorage/cli.rb, line 56 def get(group,key) puts render(Manager.new(options).get(group,key)) end
groups()
click to toggle source
# File lib/keystorage/cli.rb, line 46 def groups puts render(Manager.new(options).groups) end
keys(group)
click to toggle source
# File lib/keystorage/cli.rb, line 51 def keys(group) puts render(Manager.new(options).keys(group)) end
password(new_secret=nil)
click to toggle source
# File lib/keystorage/cli.rb, line 67 def password new_secret=nil #@todo: ask if new_secret == nil Manager.new(options).password(new_secret) end
set(group,key,value=nil)
click to toggle source
# File lib/keystorage/cli.rb, line 61 def set(group,key,value=nil) #@todo: ask if value == nil puts render Manager.new(options).set(group,key,value) end
version()
click to toggle source
# File lib/keystorage/cli.rb, line 79 def version puts Version.current end