diff --git a/src/main.cr b/src/main.cr index f7aa805..a3d7077 100644 --- a/src/main.cr +++ b/src/main.cr @@ -1,6 +1,6 @@ -require "kemal" require "uuid" require "file_utils" +require "option_parser" require "authd" @@ -13,7 +13,7 @@ storage_directory = "./projects" # It’ll get replaced later. But FIXME, this is only a temporary workaround. authd = nil.unsafe_as AuthD::Client -Kemal.config.extra_options do |parser| +OptionParser.parse do |parser| parser.on "-k file", "--jwt-key file", "Provides the JWT key for authd." do |file| authd_key = File.read(file).chomp end @@ -21,6 +21,11 @@ Kemal.config.extra_options do |parser| parser.on "-S dir", "--storage dir", "Provides a directory in which to store kanband’s data and projects." do |dir| storage_directory = dir end + + parser.on "-h", "--help", "Prints this help message." do + puts parser + exit 0 + end end class ConnectionArray < Array(Int32) @@ -55,20 +60,6 @@ end sockets = ConnectionArray.new users = ConnectionHash.new -get "/" do - File.read "index.html" -end - -get "/style.css" do |env| - env.response.content_type = "text/css" - File.read "style.css" -end - -get "/main.js" do |env| - env.response.content_type = "text/javascript" - File.read "main.js" -end - authd = AuthD::Client.new key = authd_key