added option to add service
This commit is contained in:
@@ -114,6 +114,33 @@ module Kotatsu
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
parser.on "add", "Add a service" do
|
||||||
|
if File.exists?(CONFIG_FILE) == true
|
||||||
|
version, port, title, services = readConfig()
|
||||||
|
print "Name: "
|
||||||
|
s_name = gets.to_s
|
||||||
|
print "Link: "
|
||||||
|
s_link = gets.to_s
|
||||||
|
print "Icon: "
|
||||||
|
s_icon = gets.to_s
|
||||||
|
s_service = [s_name, s_link, s_icon]
|
||||||
|
|
||||||
|
services_new = [] of Array(String)
|
||||||
|
i = 0
|
||||||
|
while services.size > i
|
||||||
|
services_new << services[i]
|
||||||
|
i+=1
|
||||||
|
end
|
||||||
|
services_new << s_service
|
||||||
|
|
||||||
|
writeConfig(version, port, title, services_new)
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
STDERR.puts "ERROR! Config file not found: #{CONFIG_FILE}"
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
parser.on "list", "Lists all services" do
|
parser.on "list", "Lists all services" do
|
||||||
if File.exists?(CONFIG_FILE) == true
|
if File.exists?(CONFIG_FILE) == true
|
||||||
_, _, _, services = readConfig()
|
_, _, _, services = readConfig()
|
||||||
|
|||||||
Reference in New Issue
Block a user