239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
# File 'lib/cnote/commands.rb', line 239
def config(params = [])
if params.length == 0
system "#{@config.editor} #{@config.path}"
@config.load
return
end
action, key, *value = params
value = value.join(" ")
if action == "get"
if key
puts "#{key}: \"#{@config.get(key)}\""
else
@config.print
end
elsif action == "set"
if key
if value
puts "Config: #{key} changed from '#{@config.get(key)}' to '#{value}'"
@config.set(key, value)
else
puts "Can't set a key to a value if no value is given."
end
else
puts "Can't set a key if one wasn't given."
end
else
puts "Invalid action: #{action}"
end
end
|