15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/tabry/shells/fish/wrapper.rb', line 15
def self.run(cmd_line, comp_point, config: nil)
cmd_name, args, last_arg = Tabry::ShellTokenizer.split_with_comppoint(cmd_line, comp_point)
opts = Tabry::Runner.new(config: config || cmd_name).options(args, last_arg, { descriptions: true })
if Tabry::Util.debug?
$stderr.puts
warn "debug: got command line and comp_point: #{cmd_line.inspect}, #{comp_point}"
warn "using args: #{args.inspect}"
warn "using lastarg: #{last_arg.inspect}"
warn "results from Tabry#options(): #{opts.inspect}"
warn "--- end debug output ---"
end
normal_opts = opts.select { |t,| t.is_a?(String) }
special_opts = opts.select { |t| t.is_a?(Symbol) }
puts normal_opts.map { |opt, desc| "#{Shellwords.escape(opt)}\t#{format_description(desc)}" }.join("\n")
if special_opts.any?
puts
puts special_opts.join("\n")
end
end
|