lib/conjur/command/variables.rb in conjur-cli-2.4.1 vs lib/conjur/command/variables.rb in conjur-cli-2.6.0
- old
+ new
@@ -3,21 +3,31 @@
class Conjur::Command::Variables < Conjur::Command
self.prefix = :variable
desc "Create and store a variable"
+ arg_name "id?"
command :create do |c|
c.arg_name "mime_type"
c.flag [:m, :"mime-type"]
c.arg_name "kind"
c.flag [:k, :"kind"]
acting_as_option(c)
c.action do |global_options,options,args|
- var = api.create_variable(options[:m], options[:k], options)
+ id = args.shift
+ options[:id] = id if id
+
+ mime_type = options.delete(:m)
+ kind = options.delete(:k)
+
+ options.delete(:"mime-type")
+ options.delete(:"kind")
+
+ var = api.create_variable(mime_type, kind, options)
display(var, options)
end
end
desc "Show a variable"
@@ -35,9 +45,10 @@
c.action do |global_options,options,args|
id = require_arg(args, 'variable')
value = args.shift || STDIN.read
api.variable(id).add_value(value)
+ puts "Value added"
end
end
desc "Get a value"
arg_name "variable"