Module: Jade::CLI
- Defined in:
- lib/jade/cli.rb,
lib/jade/cli/q.rb,
lib/jade/cli/fmt.rb,
lib/jade/cli/lsp.rb,
lib/jade/cli/check.rb
Defined Under Namespace
Modules: Check, Fmt, Lsp, Q
Constant Summary
collapse
- SUBCOMMANDS =
{
'check' => 'Check',
'fmt' => 'Fmt',
'lsp' => 'Lsp',
'q' => 'Q',
}.freeze
Class Method Summary
collapse
Class Method Details
.run(argv) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/jade/cli.rb', line 14
def run(argv)
sub, *rest = argv
case sub
when nil, '-h', '--help', 'help'
usage
when *SUBCOMMANDS.keys
require "jade/cli/#{sub}"
const_get(SUBCOMMANDS.fetch(sub)).run(rest)
else
warn "jade: unknown command #{sub.inspect}\n\n"
usage($stderr)
exit 1
end
rescue Project::NotFound, RuntimeError => e
warn "jade: #{e.message}"
exit 1
end
|
.usage(io = $stdout) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/jade/cli.rb', line 35
def usage(io = $stdout)
io.puts <<~TXT
Usage: jade COMMAND [ARGS]
check Type-check the project (or the given files).
fmt Format .jd source (stdin or file).
lsp Run the language server (stdio JSON-RPC).
q Headless query interface (hover/symbols/defn/refs/api).
Run `jade COMMAND --help` for command-specific options.
TXT
end
|