-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample
executable file
·60 lines (44 loc) · 993 Bytes
/
sample
1
2
3
4
5
6
7
8
9
10
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env ruby
$:.unshift File.expand_path("../lib/", __FILE__)
require 'thunder'
require 'thunder/options/trollop'
class Bar
include Thunder
desc "doit", "do something with the Bar class"
option :verb, type: Boolean, desc: "verbosity"
def doit(options={})
p options
end
end
class Foo
include Thunder
#options_processor TrollopAdapter
desc "noargs", ""
def noargs
end
desc "bar A", "desc"
def bar(a)
p a
end
desc "baz [options]"
option :flag, type: Boolean, short: "g", desc: "run with a flag"
option :some, type: String, desc: "something", default: "some default value"
def baz(options = {})
p options
end
desc "splat", ""
def splat(a, b, *args)
end
desc "defs", ""
def defs(a = 1, b = 2, c = 3)
end
desc "block", ""
def block(a, &block)
end
desc "complex", ""
def complex(a, b = 2, *args, &block)
end
desc "quux COMMAND...", "send COMMAND to Bar"
subcommand "quux", ::Bar.new
end
Foo.new.start