travis-cl 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +134 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +59 -0
- data/MIT_LICENSE.md +21 -0
- data/README.md +1283 -0
- data/cl.gemspec +30 -0
- data/examples/README.md +22 -0
- data/examples/_src/args/cast.erb.rb +100 -0
- data/examples/_src/args/opts.erb.rb +100 -0
- data/examples/_src/args/required.erb.rb +63 -0
- data/examples/_src/args/splat.erb.rb +55 -0
- data/examples/_src/gem.erb.rb +99 -0
- data/examples/_src/heroku.erb.rb +47 -0
- data/examples/_src/rakeish.erb.rb +54 -0
- data/examples/_src/readme/abstract.erb.rb +27 -0
- data/examples/_src/readme/alias.erb.rb +22 -0
- data/examples/_src/readme/arg.erb.rb +21 -0
- data/examples/_src/readme/arg_array.erb.rb +21 -0
- data/examples/_src/readme/arg_type.erb.rb +23 -0
- data/examples/_src/readme/args_splat.erb.rb +55 -0
- data/examples/_src/readme/array.erb.rb +21 -0
- data/examples/_src/readme/basic.erb.rb +72 -0
- data/examples/_src/readme/default.erb.rb +21 -0
- data/examples/_src/readme/deprecated.erb.rb +21 -0
- data/examples/_src/readme/deprecated_alias.erb.rb +21 -0
- data/examples/_src/readme/description.erb.rb +60 -0
- data/examples/_src/readme/downcase.erb.rb +21 -0
- data/examples/_src/readme/enum.erb.rb +35 -0
- data/examples/_src/readme/example.erb.rb +25 -0
- data/examples/_src/readme/format.erb.rb +35 -0
- data/examples/_src/readme/internal.erb.rb +28 -0
- data/examples/_src/readme/negate.erb.rb +37 -0
- data/examples/_src/readme/note.erb.rb +25 -0
- data/examples/_src/readme/opts.erb.rb +33 -0
- data/examples/_src/readme/opts_block.erb.rb +30 -0
- data/examples/_src/readme/range.erb.rb +35 -0
- data/examples/_src/readme/registry.erb.rb +18 -0
- data/examples/_src/readme/required.erb.rb +35 -0
- data/examples/_src/readme/requireds.erb.rb +46 -0
- data/examples/_src/readme/requires.erb.rb +35 -0
- data/examples/_src/readme/runner.erb.rb +29 -0
- data/examples/_src/readme/runner_custom.erb.rb +25 -0
- data/examples/_src/readme/secret.erb.rb +22 -0
- data/examples/_src/readme/see.erb.rb +25 -0
- data/examples/_src/readme/type.erb.rb +21 -0
- data/examples/args/cast +98 -0
- data/examples/args/opts +98 -0
- data/examples/args/required +62 -0
- data/examples/args/splat +58 -0
- data/examples/gem +97 -0
- data/examples/heroku +48 -0
- data/examples/rakeish +50 -0
- data/examples/readme/abstract +28 -0
- data/examples/readme/alias +21 -0
- data/examples/readme/arg +20 -0
- data/examples/readme/arg_array +20 -0
- data/examples/readme/arg_type +22 -0
- data/examples/readme/args_splat +58 -0
- data/examples/readme/array +20 -0
- data/examples/readme/basic +67 -0
- data/examples/readme/default +20 -0
- data/examples/readme/deprecated +20 -0
- data/examples/readme/deprecated_alias +20 -0
- data/examples/readme/description +56 -0
- data/examples/readme/downcase +20 -0
- data/examples/readme/enum +33 -0
- data/examples/readme/example +21 -0
- data/examples/readme/format +33 -0
- data/examples/readme/internal +24 -0
- data/examples/readme/negate +44 -0
- data/examples/readme/note +21 -0
- data/examples/readme/opts +31 -0
- data/examples/readme/opts_block +29 -0
- data/examples/readme/range +33 -0
- data/examples/readme/registry +15 -0
- data/examples/readme/required +33 -0
- data/examples/readme/requireds +46 -0
- data/examples/readme/requires +33 -0
- data/examples/readme/runner +30 -0
- data/examples/readme/runner_custom +22 -0
- data/examples/readme/secret +21 -0
- data/examples/readme/see +21 -0
- data/examples/readme/type +20 -0
- data/lib/cl/arg.rb +79 -0
- data/lib/cl/args.rb +92 -0
- data/lib/cl/cast.rb +55 -0
- data/lib/cl/cmd.rb +74 -0
- data/lib/cl/config/env.rb +52 -0
- data/lib/cl/config/files.rb +34 -0
- data/lib/cl/config.rb +30 -0
- data/lib/cl/ctx.rb +36 -0
- data/lib/cl/dsl.rb +182 -0
- data/lib/cl/errors.rb +119 -0
- data/lib/cl/help/cmd.rb +118 -0
- data/lib/cl/help/cmds.rb +26 -0
- data/lib/cl/help/format.rb +69 -0
- data/lib/cl/help/table.rb +58 -0
- data/lib/cl/help/usage.rb +26 -0
- data/lib/cl/help.rb +37 -0
- data/lib/cl/helper/suggest.rb +10 -0
- data/lib/cl/helper.rb +47 -0
- data/lib/cl/opt.rb +276 -0
- data/lib/cl/opts/validate.rb +117 -0
- data/lib/cl/opts.rb +114 -0
- data/lib/cl/parser/format.rb +63 -0
- data/lib/cl/parser.rb +70 -0
- data/lib/cl/runner/default.rb +86 -0
- data/lib/cl/runner/multi.rb +34 -0
- data/lib/cl/runner.rb +10 -0
- data/lib/cl/ui.rb +146 -0
- data/lib/cl/version.rb +3 -0
- data/lib/cl.rb +62 -0
- metadata +177 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', alias: :group
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
# p opts: opts, to: to, to?: to?, group: group, group?: group?
|
|
13
|
+
p opts: opts, to: to, to?: to?
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Cl.new('owners').run(%w(add --group one))
|
|
18
|
+
|
|
19
|
+
# Output:
|
|
20
|
+
#
|
|
21
|
+
# {:opts=>{:to=>"one", :group=>"one"}, :to=>"one", :to?=>true}
|
data/examples/readme/arg
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
arg :owner
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p owner: owner
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add one))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:owner=>"one"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
arg :owners, type: :array, sep: ','
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p owners: owners
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add one,two))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:owners=>["one", "two"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Cmd < Cl::Cmd
|
|
7
|
+
register :cmd
|
|
8
|
+
|
|
9
|
+
arg :one, type: :integer
|
|
10
|
+
arg :two, type: :float
|
|
11
|
+
arg :three, type: :boolean
|
|
12
|
+
|
|
13
|
+
def run
|
|
14
|
+
p [one.class, two.class, three.class]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Cl.new('owners').run(%w(cmd 1 2.1 yes))
|
|
19
|
+
|
|
20
|
+
# Output:
|
|
21
|
+
#
|
|
22
|
+
# [Integer, Float, TrueClass]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Lft < Cl::Cmd
|
|
7
|
+
register :lft
|
|
8
|
+
|
|
9
|
+
arg :a, type: :array, splat: true
|
|
10
|
+
arg :b
|
|
11
|
+
arg :c
|
|
12
|
+
|
|
13
|
+
def run
|
|
14
|
+
p [a, b, c]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class Mid < Cl::Cmd
|
|
19
|
+
register :mid
|
|
20
|
+
|
|
21
|
+
arg :a
|
|
22
|
+
arg :b, type: :array, splat: true
|
|
23
|
+
arg :c
|
|
24
|
+
|
|
25
|
+
def run
|
|
26
|
+
p [a, b, c]
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class Rgt < Cl::Cmd
|
|
31
|
+
register :rgt
|
|
32
|
+
|
|
33
|
+
arg :a
|
|
34
|
+
arg :b
|
|
35
|
+
arg :c, type: :array, splat: true
|
|
36
|
+
|
|
37
|
+
def run
|
|
38
|
+
p [a, b, c]
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
Cl.new('splat').run(%w(lft 1 2 3 4 5))
|
|
43
|
+
|
|
44
|
+
# Output:
|
|
45
|
+
#
|
|
46
|
+
# [["1", "2", "3"], "4", "5"]
|
|
47
|
+
|
|
48
|
+
Cl.new('splat').run(%w(mid 1 2 3 4 5))
|
|
49
|
+
|
|
50
|
+
# Output:
|
|
51
|
+
#
|
|
52
|
+
# ["1", ["2", "3", "4"], "5"]
|
|
53
|
+
|
|
54
|
+
Cl.new('splat').run(%w(rgt 1 2 3 4 5))
|
|
55
|
+
|
|
56
|
+
# Output:
|
|
57
|
+
#
|
|
58
|
+
# ["1", "2", ["3", "4", "5"]]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', type: :array
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p to
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add --to one --to two))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# ["one", "two"]
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'cl'
|
|
2
|
+
|
|
3
|
+
# e.g. lib/owners/add.rb
|
|
4
|
+
module Owners
|
|
5
|
+
class Add < Cl::Cmd
|
|
6
|
+
register :add
|
|
7
|
+
|
|
8
|
+
summary 'Add one or more owners to an existing owner group'
|
|
9
|
+
|
|
10
|
+
description <<~str
|
|
11
|
+
Use this command to add one or more owners to an existing
|
|
12
|
+
owner group.
|
|
13
|
+
|
|
14
|
+
[...]
|
|
15
|
+
str
|
|
16
|
+
|
|
17
|
+
args :owner
|
|
18
|
+
|
|
19
|
+
opt '-t', '--to TO', 'An existing owner group'
|
|
20
|
+
|
|
21
|
+
def run
|
|
22
|
+
# implement adding the owner as given in `owner` (as well as `args`)
|
|
23
|
+
# to the group given in `to` (as well as `opts[:to]`).
|
|
24
|
+
p owner: owner, to: to, to?: to?, args: args, opts: opts
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Running this, e.g. using `bin/owners add one,two --to group` will instantiate the
|
|
30
|
+
# class `Owners::Add`, and call the method `run` on it.
|
|
31
|
+
|
|
32
|
+
# e.g. bin/owners
|
|
33
|
+
#
|
|
34
|
+
# args normally would be ARGV
|
|
35
|
+
args = %w(add one --to group)
|
|
36
|
+
|
|
37
|
+
Cl.new('owners').run(args)
|
|
38
|
+
|
|
39
|
+
# Output:
|
|
40
|
+
#
|
|
41
|
+
# {:owner=>"one", :to=>"group", :to?=>true, :args=>["one"], :opts=>{:to=>"group"}}
|
|
42
|
+
|
|
43
|
+
Cl.new('owners').run(%w(add --help))
|
|
44
|
+
|
|
45
|
+
# Output:
|
|
46
|
+
#
|
|
47
|
+
# Usage: owners add [owner] [options]
|
|
48
|
+
#
|
|
49
|
+
# Summary:
|
|
50
|
+
#
|
|
51
|
+
# Add one or more owners to an existing owner group
|
|
52
|
+
#
|
|
53
|
+
# Description:
|
|
54
|
+
#
|
|
55
|
+
# Use this command to add one or more owners to an existing
|
|
56
|
+
# owner group.
|
|
57
|
+
#
|
|
58
|
+
# [...]
|
|
59
|
+
#
|
|
60
|
+
# Arguments:
|
|
61
|
+
#
|
|
62
|
+
# owner type: string
|
|
63
|
+
#
|
|
64
|
+
# Options:
|
|
65
|
+
#
|
|
66
|
+
# -t --to TO An existing owner group (type: string)
|
|
67
|
+
# --help Get help on this command
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', default: 'default'
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p to: to
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:to=>"default"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--target GROUP', deprecated: 'Deprecated.'
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p target: target, deprecations: deprecations
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add --target one))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:target=>"one", :deprecations=>{:target=>"Deprecated."}}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', alias: :target, deprecated: :target
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p to: to, deprecations: deprecations
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add --target one))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:to=>"one", :deprecations=>{:target=>:to}}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
module Owners
|
|
7
|
+
class Add < Cl::Cmd
|
|
8
|
+
register :add
|
|
9
|
+
|
|
10
|
+
summary 'Add one or more owners to an existing owner group'
|
|
11
|
+
|
|
12
|
+
description <<~str
|
|
13
|
+
Use this command to add one or more owners to an existing
|
|
14
|
+
owner group.
|
|
15
|
+
str
|
|
16
|
+
|
|
17
|
+
examples <<~str
|
|
18
|
+
Adding a single user to the group admins:
|
|
19
|
+
|
|
20
|
+
owners add user --to admins
|
|
21
|
+
|
|
22
|
+
Adding a several users at once:
|
|
23
|
+
|
|
24
|
+
owners add one two three --to admins
|
|
25
|
+
str
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Cl.new('owners').run(%w(add --help))
|
|
30
|
+
|
|
31
|
+
# Output:
|
|
32
|
+
#
|
|
33
|
+
# Usage: owners add [options]
|
|
34
|
+
#
|
|
35
|
+
# Summary:
|
|
36
|
+
#
|
|
37
|
+
# Add one or more owners to an existing owner group
|
|
38
|
+
#
|
|
39
|
+
# Description:
|
|
40
|
+
#
|
|
41
|
+
# Use this command to add one or more owners to an existing
|
|
42
|
+
# owner group.
|
|
43
|
+
#
|
|
44
|
+
# Options:
|
|
45
|
+
#
|
|
46
|
+
# --help Get help on this command
|
|
47
|
+
#
|
|
48
|
+
# Examples:
|
|
49
|
+
#
|
|
50
|
+
# Adding a single user to the group admins:
|
|
51
|
+
#
|
|
52
|
+
# owners add user --to admins
|
|
53
|
+
#
|
|
54
|
+
# Adding a several users at once:
|
|
55
|
+
#
|
|
56
|
+
# owners add one two three --to admins
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', downcase: true
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p to: to
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add --to ONE))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:to=>"one"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', enum: %w(one two)
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p to: to
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add --to one))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:to=>"one"}
|
|
21
|
+
|
|
22
|
+
Cl.new('owners').run(%w(add --to unknown))
|
|
23
|
+
|
|
24
|
+
# Output:
|
|
25
|
+
#
|
|
26
|
+
# Unknown value: to=unknown (known values: one, two)
|
|
27
|
+
#
|
|
28
|
+
# Usage: owners add [options]
|
|
29
|
+
#
|
|
30
|
+
# Options:
|
|
31
|
+
#
|
|
32
|
+
# --to GROUP type: string, known values: one, two
|
|
33
|
+
# --help Get help on this command
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', example: 'group-one'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Cl.new('owners').run(%w(add --help))
|
|
13
|
+
|
|
14
|
+
# Output:
|
|
15
|
+
#
|
|
16
|
+
# Usage: owners add [options]
|
|
17
|
+
#
|
|
18
|
+
# Options:
|
|
19
|
+
#
|
|
20
|
+
# --to GROUP type: string, e.g.: group-one
|
|
21
|
+
# --help Get help on this command
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', format: /^\w+$/
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p to: to
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add --to one))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:to=>"one"}
|
|
21
|
+
|
|
22
|
+
Cl.new('owners').run(['add', '--to', 'does not match!'])
|
|
23
|
+
|
|
24
|
+
# Output:
|
|
25
|
+
#
|
|
26
|
+
# Invalid format: to (format: /^\w+$/)
|
|
27
|
+
#
|
|
28
|
+
# Usage: owners add [options]
|
|
29
|
+
#
|
|
30
|
+
# Options:
|
|
31
|
+
#
|
|
32
|
+
# --to GROUP type: string, format: /^\w+$/
|
|
33
|
+
# --help Get help on this command
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
require 'cl'
|
|
7
|
+
|
|
8
|
+
class Add < Cl::Cmd
|
|
9
|
+
register :add
|
|
10
|
+
|
|
11
|
+
opt '--to GROUP'
|
|
12
|
+
opt '--hidden', internal: true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Cl.new('owners').run(%w(add --help))
|
|
16
|
+
|
|
17
|
+
# Output:
|
|
18
|
+
#
|
|
19
|
+
# Usage: owners add [options]
|
|
20
|
+
#
|
|
21
|
+
# Options:
|
|
22
|
+
#
|
|
23
|
+
# --to GROUP type: string
|
|
24
|
+
# --help Get help on this command
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--notifications', 'Send out notifications to the team', negate: %w(skip)
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p notifications?
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add --notifications))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# true
|
|
21
|
+
|
|
22
|
+
Cl.new('owners').run(%w(add --no_notifications))
|
|
23
|
+
|
|
24
|
+
# Output:
|
|
25
|
+
#
|
|
26
|
+
# false
|
|
27
|
+
|
|
28
|
+
Cl.new('owners').run(%w(add --no-notifications))
|
|
29
|
+
|
|
30
|
+
# Output:
|
|
31
|
+
#
|
|
32
|
+
# false
|
|
33
|
+
|
|
34
|
+
Cl.new('owners').run(%w(add --skip_notifications))
|
|
35
|
+
|
|
36
|
+
# Output:
|
|
37
|
+
#
|
|
38
|
+
# false
|
|
39
|
+
|
|
40
|
+
Cl.new('owners').run(%w(add --skip-notifications))
|
|
41
|
+
|
|
42
|
+
# Output:
|
|
43
|
+
#
|
|
44
|
+
# false
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', note: 'needs to be a group'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Cl.new('owners').run(%w(add --help))
|
|
13
|
+
|
|
14
|
+
# Output:
|
|
15
|
+
#
|
|
16
|
+
# Usage: owners add [options]
|
|
17
|
+
#
|
|
18
|
+
# Options:
|
|
19
|
+
#
|
|
20
|
+
# --to GROUP type: string, note: needs to be a group
|
|
21
|
+
# --help Get help on this command
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', 'Target group to add owners to'
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p opts: opts, to: to, to?: to?
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add --to one))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:opts=>{:to=>"one"}, :to=>"one", :to?=>true}
|
|
21
|
+
|
|
22
|
+
Cl.new('owners').run(%w(add --help))
|
|
23
|
+
|
|
24
|
+
# Output:
|
|
25
|
+
#
|
|
26
|
+
# Usage: owners add [options]
|
|
27
|
+
#
|
|
28
|
+
# Options:
|
|
29
|
+
#
|
|
30
|
+
# --to GROUP Target group to add owners to (type: string)
|
|
31
|
+
# --help Get help on this command
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
# depending on its arity the block can receive:
|
|
10
|
+
#
|
|
11
|
+
# * value
|
|
12
|
+
# * value, name
|
|
13
|
+
# * value, name, type
|
|
14
|
+
# * value, name, type, opts
|
|
15
|
+
opt '--to GROUP' do |value|
|
|
16
|
+
opts[:to] = "group-#{value}"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def run
|
|
20
|
+
p to: to
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
Cl.new('owners').run(%w(add --to one))
|
|
25
|
+
|
|
26
|
+
# Output:
|
|
27
|
+
#
|
|
28
|
+
# {:to=>"group-one"}
|
|
29
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--retries COUNT', type: :integer, min: 1, max: 5
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p retries: retries
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add --retries 1))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:retries=>1}
|
|
21
|
+
|
|
22
|
+
Cl.new('owners').run(%w(add --retries 10))
|
|
23
|
+
|
|
24
|
+
# Output:
|
|
25
|
+
#
|
|
26
|
+
# Out of range: retries (min: 1, max: 5)
|
|
27
|
+
#
|
|
28
|
+
# Usage: owners add [options]
|
|
29
|
+
#
|
|
30
|
+
# Options:
|
|
31
|
+
#
|
|
32
|
+
# --retries COUNT type: integer, min: 1, max: 5
|
|
33
|
+
# --help Get help on this command
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
register :add
|
|
8
|
+
|
|
9
|
+
opt '--to GROUP', required: true
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
p to: to
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Cl.new('owners').run(%w(add --to one))
|
|
17
|
+
|
|
18
|
+
# Output:
|
|
19
|
+
#
|
|
20
|
+
# {:to=>"one"}
|
|
21
|
+
|
|
22
|
+
Cl.new('owners').run(%w(add))
|
|
23
|
+
|
|
24
|
+
# Output:
|
|
25
|
+
#
|
|
26
|
+
# Missing required option: to
|
|
27
|
+
#
|
|
28
|
+
# Usage: owners add [options]
|
|
29
|
+
#
|
|
30
|
+
# Options:
|
|
31
|
+
#
|
|
32
|
+
# --to GROUP type: string, required
|
|
33
|
+
# --help Get help on this command
|