added option to list all services
This commit is contained in:
@@ -73,6 +73,22 @@ module Kotatsu
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
parser.on "list", "Lists all services" do
|
||||||
|
if File.exists?(CONFIG_FILE) == true
|
||||||
|
conf = JSON.parse(File.read(CONFIG_FILE))
|
||||||
|
services = conf["services"].as_a
|
||||||
|
i = 0
|
||||||
|
while services.size > i
|
||||||
|
puts "##{i}: #{services[i][0]} ; #{services[i][1]} ; #{services[i][2]}"
|
||||||
|
i+=1
|
||||||
|
end
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
STDERR.puts "ERROR! Config file not found: #{CONFIG_FILE}"
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
parser.invalid_option do |flag|
|
parser.invalid_option do |flag|
|
||||||
STDERR.puts "ERROR! Not a valid option: #{flag}"
|
STDERR.puts "ERROR! Not a valid option: #{flag}"
|
||||||
STDERR.puts "Use -h or --help for all available options"
|
STDERR.puts "Use -h or --help for all available options"
|
||||||
|
|||||||
Reference in New Issue
Block a user