- add basic CLI

This commit is contained in:
Alex Ling
2020-02-17 02:52:21 +00:00
parent b4fcbf15ca
commit 2fe6506b2e
2 changed files with 26 additions and 7 deletions

View File

@@ -1,11 +1,29 @@
require "./server"
require "./context"
require "./config"
require "./library"
require "./storage"
require "./logger"
require "option_parser"
config = Config.load
VERSION = "0.1.0"
config_path = nil
parser = OptionParser.parse do |parser|
parser.banner = "Mango e-manga server/reader. Version #{VERSION}\n"
parser.on "-v", "--version", "Show version" do
puts "Version #{VERSION}"
exit
end
parser.on "-h", "--help", "Show help" do
puts parser
exit
end
parser.on "-c PATH", "--config=PATH", "Path to the config file. " \
"Default is `~/.config/mango/config.yml`" do |path|
config_path = path
end
end
config = Config.load config_path
logger = MLogger.new config
library = Library.new config.library_path, config.scan_interval, logger
storage = Storage.new config.db_path, logger