Module: FlogLsp::Cli

Defined in:
lib/flog_lsp/cli.rb

Class Method Summary collapse

Class Method Details

.startObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/flog_lsp/cli.rb', line 11

def start
  options = {}
  OptionParser.new do |opts|
    opts.banner = "Usage: flog-lsp [options]"
    opts.on("-v", "--verbose", "Run verbosely") do |v|
      options[:verbose] = v
    end
    opts.on("-h", "--help", "Prints this help") do
      puts opts
      exit
    end
  end.parse!
  logger = FlogLsp.logger = Logger.new($stderr)
  # logger = FlogLsp.logger = Logger.new("flog-lsp.log")
  logger.level = options[:verbose] ? Logger::DEBUG : Logger::INFO
  logger.info("flog-lsp version #{FlogLsp::VERSION} starting...")
  lsp = FlogLsp::Server.new
  lsp.start
end