1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-11-23 22:03:05 +00:00
mpw/mpw-server

47 lines
957 B
Text
Raw Normal View History

2014-01-10 16:55:05 +00:00
#!/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