Class: Mycmd::ConfigCommands

Inherits:
Thor
  • Object
show all
Defined in:
lib/mycmd/cli/config_commands.rb

Instance Method Summary collapse

Instance Method Details

#catObject



14
15
16
17
18
19
20
21
22
# File 'lib/mycmd/cli/config_commands.rb', line 14

def cat
  begin
    conf = Configuration.config_find
    raise "config not found" if conf.nil?
    File.open(conf, "r").each {|line| puts line}
  rescue => e
    puts e.message
  end
end

#editObject



25
26
27
28
29
30
31
32
33
# File 'lib/mycmd/cli/config_commands.rb', line 25

def edit
  begin
    conf = Configuration.config_find
    raise "config not found" if conf.nil?
    Kernel.system("#{ENV['EDITOR']} #{conf}")
  rescue => e
    puts e.message
  end
end

#whichObject



8
9
10
11
# File 'lib/mycmd/cli/config_commands.rb', line 8

def which
  conf = Configuration.config_find
  puts conf.nil? ? "config not found" : conf
end