1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-11-23 13:57:52 +00:00
mpw/mpw-server
2014-01-10 17:55:05 +01:00

46 lines
957 B
Ruby
Executable file

#!/usr/bin/ruby
# author: nishiki
# mail: nishiki@yaegashi.fr
# info: a simple script who manage your passwords
require 'rubygems'
require 'optparse'
require 'pathname'
APP_ROOT = File.dirname(Pathname.new(__FILE__).realpath)
require "#{APP_ROOT}/lib/Server.rb"
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: mpw-server -c CONFIG [options]"
opts.on("-c", "--config CONFIG", "Specifie the configuration file") do |config|
options[:config] = config
end
opts.on("-t", "--check-config", "Check your configuration") do |b|
options[:checkconfig] = b
end
opts.on("-s", "--setup", "Force a server") do |b|
options[:setup] = b
end
opts.on("-h", "--help", "Show this message") do |b|
puts opts
exit 0
end
end.parse!
server = Server.new
if options[:checkconfig]
server.checkconfig(options[:config])
elsif options[:setup]
server.setup(options[:config])
else
server.checkconfig(options[:config])
server.start()
end
exit 0