Compare commits

...

3 Commits

Author SHA1 Message Date
9974cadb4e added basic http server 2021-12-29 01:48:15 +01:00
1c9e57de26 updated .gitignore 2021-12-29 01:48:06 +01:00
2b50672ea9 added basic cli parser 2021-12-29 01:36:30 +01:00
2 changed files with 28 additions and 1 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@
/bin/
/.shards/
*.dwarf
kotatsu

View File

@@ -1,6 +1,32 @@
# TODO: Write documentation for `Kotatsu`
require "option_parser"
require "http/server"
module Kotatsu
VERSION = "0.1.0"
# TODO: Put your code here
OptionParser.parse do |parser|
parser.banner = "Kotatsu - Easy to configure server start page"
parser.on "-h", "--help", "Show this help" do
puts parser
exit
end
parser.on "-v", "--version", "Show kotatsu version" do
puts VERSION
exit
end
end
webserv = HTTP::Server.new do |context|
context.response.content_type = "text/plain"
context.response.print "Running kotatsu #{VERSION}"
end
webaddr = webserv.bind_tcp 8080
puts "Started kotatsu webserver on #{webaddr}"
webserv.listen
end