diff --git a/src/kotatsu.cr b/src/kotatsu.cr index a3764be..1d155c8 100644 --- a/src/kotatsu.cr +++ b/src/kotatsu.cr @@ -73,6 +73,22 @@ module Kotatsu 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| STDERR.puts "ERROR! Not a valid option: #{flag}" STDERR.puts "Use -h or --help for all available options"