Class: Neovim::Host::CLI Private

Inherits:
Object show all
Defined in:
lib/neovim/host/cli.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.run(path, argv, inn, out, err) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/neovim/host/cli.rb', line 11

def self.run(path, argv, inn, out, err)
  cmd = File.basename(path)

  OptionParser.new do |opts|
    opts.on("-V", "--version") do
      out.puts Neovim::VERSION
      exit(0)
    end

    opts.on("-h", "--help") do
      out.puts "Usage: #{cmd} [-hV] rplugin_path ..."
      exit(0)
    end
  end.order!(argv)

  if inn.tty?
    err.puts("Can't run #{cmd} interactively.")
    exit(1)
  else
    conn = Connection.new(inn, out)
    event_loop = EventLoop.new(conn)

    Host.run(argv, event_loop)
  end
rescue OptionParser::InvalidOption => e
  err.puts(e.message)
  exit(1)
end