Class: LspRouter::CLI
- Inherits:
-
Object
- Object
- LspRouter::CLI
- Defined in:
- lib/lsp_router/cli.rb
Overview
command line interface
Class Method Summary collapse
Class Method Details
.start ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lsp_router/cli.rb', line 6 def self.start port = nil logfile = nil error = nil opts = OptionParser.new opts.version = LspRouter::VERSION opts. = "Usage: #{File.basename $0} [options] config_file" opts.on('-p', '--port=port'){|v| port = v} opts.on('--logfile=file'){|v| logfile = v} opts.on('--error=file'){|v| error = v} opts.parse!(ARGV) if error $stderr = File.open(error, 'a') $stderr.sync = true end if ARGV.size != 1 puts opts.help exit 1 end config_file, = ARGV load config_file, LspRouter::Config::M LspRouter.new(LspRouter::Config.instance, port:, logfile:).run end |