cl 0.1.28 → 1.0.0
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 +5 -5
- data/Gemfile +1 -0
- data/Gemfile.lock +19 -1
- data/NOTES.md +2 -0
- data/README.md +210 -142
- data/examples/args/cast +53 -41
- data/examples/args/opts +72 -14
- data/examples/args/required +28 -14
- data/examples/args/splat +29 -32
- data/examples/gem +26 -37
- data/examples/heroku +15 -16
- data/examples/rakeish +13 -15
- data/examples/readme/abstract +6 -5
- data/examples/readme/alias +4 -7
- data/examples/readme/arg +4 -2
- data/examples/readme/arg_array +4 -2
- data/examples/readme/arg_type +3 -1
- data/examples/readme/args_splat +13 -4
- data/examples/readme/default +2 -2
- data/examples/readme/deprecated +3 -6
- data/examples/readme/deprecated_alias +2 -4
- data/examples/readme/downcase +2 -2
- data/examples/readme/enum +10 -5
- data/examples/readme/example +6 -4
- data/examples/readme/format +9 -7
- data/examples/readme/internal +8 -4
- data/examples/readme/negate +20 -5
- data/examples/readme/node +19 -0
- data/examples/readme/opts +8 -8
- data/examples/readme/opts_block +4 -3
- data/examples/readme/range +9 -7
- data/examples/readme/required +9 -7
- data/examples/readme/requireds +26 -18
- data/examples/readme/requires +13 -14
- data/examples/readme/secret +7 -9
- data/examples/readme/see +6 -8
- data/examples/readme/type +2 -6
- data/examples/src/args/cast.erb.rb +96 -0
- data/examples/src/args/opts.erb.rb +96 -0
- data/examples/src/args/required.erb.rb +61 -0
- data/examples/src/args/splat.erb.rb +55 -0
- data/examples/src/gem.erb.rb +95 -0
- data/examples/src/heroku.erb.rb +47 -0
- data/examples/src/rakeish.erb.rb +54 -0
- data/examples/src/readme/abstract.erb.rb +25 -0
- data/examples/src/readme/alias.erb.rb +20 -0
- data/examples/src/readme/arg.erb.rb +19 -0
- data/examples/src/readme/arg_array.erb.rb +19 -0
- data/examples/src/readme/arg_type.erb.rb +21 -0
- data/examples/src/readme/args_splat.erb.rb +49 -0
- data/examples/src/readme/array.erb.rb +19 -0
- data/examples/src/readme/default.erb.rb +19 -0
- data/examples/src/readme/deprecated.erb.rb +19 -0
- data/examples/src/readme/deprecated_alias.erb.rb +19 -0
- data/examples/src/readme/downcase.erb.rb +19 -0
- data/examples/src/readme/enum.erb.rb +33 -0
- data/examples/src/readme/example.erb.rb +23 -0
- data/examples/src/readme/format.erb.rb +33 -0
- data/examples/src/readme/internal.erb.rb +26 -0
- data/examples/src/readme/negate.erb.rb +35 -0
- data/examples/src/readme/node.erb.rb +23 -0
- data/examples/src/readme/opts.erb.rb +31 -0
- data/examples/src/readme/opts_block.erb.rb +28 -0
- data/examples/src/readme/range.erb.rb +33 -0
- data/examples/src/readme/required.erb.rb +33 -0
- data/examples/src/readme/requireds.erb.rb +44 -0
- data/examples/src/readme/requires.erb.rb +33 -0
- data/examples/src/readme/secret.erb.rb +20 -0
- data/examples/src/readme/see.erb.rb +23 -0
- data/examples/src/readme/type.erb.rb +19 -0
- data/lib/cl/ui.rb +2 -2
- data/lib/cl/version.rb +1 -1
- metadata +40 -10
data/examples/heroku
CHANGED
|
@@ -12,7 +12,9 @@ module Heroku
|
|
|
12
12
|
|
|
13
13
|
opt '-o', '--org ORG'
|
|
14
14
|
|
|
15
|
-
def run
|
|
15
|
+
def run
|
|
16
|
+
p cmd: registry_key, args: args, opts: opts
|
|
17
|
+
end
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
class List < Cl::Cmd
|
|
@@ -20,30 +22,27 @@ module Heroku
|
|
|
20
22
|
|
|
21
23
|
opt '-a', '--app APP'
|
|
22
24
|
|
|
23
|
-
def run
|
|
25
|
+
def run
|
|
26
|
+
p cmd: registry_key, args: args, opts: opts
|
|
27
|
+
end
|
|
24
28
|
end
|
|
25
29
|
end
|
|
26
30
|
end
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
output *Cl.new($0).run(%w(apps:create name -o org))
|
|
33
|
-
|
|
34
|
-
# Output:
|
|
32
|
+
Cl.new('heroku').run(%w(apps:create name -o org))
|
|
33
|
+
# or:
|
|
35
34
|
#
|
|
36
|
-
#
|
|
37
|
-
|
|
38
|
-
output *Cl.new($0).run(%w(apps create name -o org))
|
|
35
|
+
# Cl.new('heroku').run(%w(apps create name -o org))
|
|
39
36
|
|
|
40
37
|
# Output:
|
|
41
38
|
#
|
|
42
|
-
#
|
|
39
|
+
# {:cmd=>:"apps:create", :args=>["name"], :opts=>{:org=>"org"}}
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
Cl.new('heroku').run(%w(apps:info -a app))
|
|
42
|
+
# or:
|
|
43
|
+
#
|
|
44
|
+
# Cl.new('heroku').run(%w(apps info -a app))
|
|
45
45
|
|
|
46
46
|
# Output:
|
|
47
47
|
#
|
|
48
|
-
#
|
|
49
|
-
|
|
48
|
+
# {:cmd=>:"apps:info", :args=>[], :opts=>{:app=>"app"}}
|
data/examples/rakeish
CHANGED
|
@@ -10,7 +10,9 @@ module Rakeish
|
|
|
10
10
|
|
|
11
11
|
arg :name
|
|
12
12
|
|
|
13
|
-
def run
|
|
13
|
+
def run
|
|
14
|
+
p cmd: registry_key, args: args, opts: opts
|
|
15
|
+
end
|
|
14
16
|
end
|
|
15
17
|
|
|
16
18
|
class Drop < Cl::Cmd
|
|
@@ -20,7 +22,9 @@ module Rakeish
|
|
|
20
22
|
|
|
21
23
|
opt '-f', '--force'
|
|
22
24
|
|
|
23
|
-
def run
|
|
25
|
+
def run
|
|
26
|
+
p cmd: registry_key, args: args, opts: opts
|
|
27
|
+
end
|
|
24
28
|
end
|
|
25
29
|
|
|
26
30
|
class Migrate < Cl::Cmd
|
|
@@ -30,23 +34,17 @@ module Rakeish
|
|
|
30
34
|
|
|
31
35
|
opt '-v', '--version VERSION'
|
|
32
36
|
|
|
33
|
-
def run
|
|
37
|
+
def run
|
|
38
|
+
p cmd: registry_key, args: args, opts: opts
|
|
39
|
+
end
|
|
34
40
|
end
|
|
35
41
|
end
|
|
36
42
|
end
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
result.each do |cmd, args, opts|
|
|
40
|
-
puts "Called #{cmd} with args=#{args} opts=#{opts}"
|
|
41
|
-
end
|
|
42
|
-
puts
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
argv = %w(db:drop production -f db:create db:migrate production -v 1)
|
|
46
|
-
output Cl.new($0, runner: :multi).run(argv)
|
|
44
|
+
Cl.new('rake', runner: :multi).run(%w(db:drop production -f db:create db:migrate production -v 1))
|
|
47
45
|
|
|
48
46
|
# Output:
|
|
49
47
|
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
48
|
+
# {:cmd=>:"db:drop", :args=>["production"], :opts=>{:force=>true}}
|
|
49
|
+
# {:cmd=>:"db:create", :args=>[], :opts=>{}}
|
|
50
|
+
# {:cmd=>:"db:migrate", :args=>["production"], :opts=>{:version=>"1"}}
|
data/examples/readme/abstract
CHANGED
|
@@ -8,18 +8,19 @@ class Base < Cl::Cmd
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
class Add < Base
|
|
11
|
+
def run
|
|
12
|
+
puts 'Success'
|
|
13
|
+
end
|
|
11
14
|
end
|
|
12
15
|
|
|
13
|
-
Cl.new('owners').
|
|
16
|
+
Cl.new('owners').run(%w(add))
|
|
14
17
|
|
|
15
18
|
# Output:
|
|
16
19
|
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
# owners add [options]
|
|
20
|
+
# Success
|
|
20
21
|
|
|
21
22
|
Cl.new('owners').run(%w(base))
|
|
22
23
|
|
|
23
|
-
#
|
|
24
|
+
# Output:
|
|
24
25
|
#
|
|
25
26
|
# Unknown command: base
|
data/examples/readme/alias
CHANGED
|
@@ -7,16 +7,13 @@ class Add < Cl::Cmd
|
|
|
7
7
|
opt '--to GROUP', alias: :group
|
|
8
8
|
|
|
9
9
|
def run
|
|
10
|
-
p opts, to, to?, group, group?
|
|
10
|
+
# p opts: opts, to: to, to?: to?, group: group, group?: group?
|
|
11
|
+
p opts: opts, to: to, to?: to?
|
|
11
12
|
end
|
|
12
13
|
end
|
|
13
14
|
|
|
14
|
-
Cl.new('owners').run(%w(add --
|
|
15
|
+
Cl.new('owners').run(%w(add --group one))
|
|
15
16
|
|
|
16
17
|
# Output:
|
|
17
18
|
#
|
|
18
|
-
# {
|
|
19
|
-
# "one"
|
|
20
|
-
# true
|
|
21
|
-
# "one"
|
|
22
|
-
# true
|
|
19
|
+
# {:opts=>{:to=>"one", :group=>"one"}, :to=>"one", :to?=>true}
|
data/examples/readme/arg
CHANGED
data/examples/readme/arg_array
CHANGED
data/examples/readme/arg_type
CHANGED
data/examples/readme/args_splat
CHANGED
|
@@ -34,10 +34,19 @@ class Rgt < Cl::Cmd
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
Cl.new('splat').run(%w(lft 1 2 3 4 5))
|
|
37
|
+
|
|
38
|
+
# Output:
|
|
39
|
+
#
|
|
40
|
+
# [["1", "2", "3"], "4", "5"]
|
|
41
|
+
|
|
37
42
|
Cl.new('splat').run(%w(mid 1 2 3 4 5))
|
|
43
|
+
|
|
44
|
+
# Output:
|
|
45
|
+
#
|
|
46
|
+
# ["1", ["2", "3", "4"], "5"]
|
|
47
|
+
|
|
38
48
|
Cl.new('splat').run(%w(rgt 1 2 3 4 5))
|
|
39
49
|
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
# ["1", "2", ["3", "4", "5"]]
|
|
50
|
+
# Output:
|
|
51
|
+
#
|
|
52
|
+
# ["1", "2", ["3", "4", "5"]]
|
data/examples/readme/default
CHANGED
data/examples/readme/deprecated
CHANGED
|
@@ -4,11 +4,10 @@ $: << File.expand_path('lib')
|
|
|
4
4
|
require 'cl'
|
|
5
5
|
|
|
6
6
|
class Add < Cl::Cmd
|
|
7
|
-
opt '--
|
|
8
|
-
opt '--target GROUP', deprecated: 'Deprecated: --target'
|
|
7
|
+
opt '--target GROUP', deprecated: 'Deprecated.'
|
|
9
8
|
|
|
10
9
|
def run
|
|
11
|
-
p
|
|
10
|
+
p target: target, deprecations: deprecations
|
|
12
11
|
end
|
|
13
12
|
end
|
|
14
13
|
|
|
@@ -16,6 +15,4 @@ Cl.new('owners').run(%w(add --target one))
|
|
|
16
15
|
|
|
17
16
|
# Output:
|
|
18
17
|
#
|
|
19
|
-
# "one"
|
|
20
|
-
# {:target=>'Deprecated: --target'}
|
|
21
|
-
|
|
18
|
+
# {:target=>"one", :deprecations=>{:target=>"Deprecated."}}
|
|
@@ -7,7 +7,7 @@ class Add < Cl::Cmd
|
|
|
7
7
|
opt '--to GROUP', alias: :target, deprecated: :target
|
|
8
8
|
|
|
9
9
|
def run
|
|
10
|
-
p to,
|
|
10
|
+
p to: to, deprecations: deprecations
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -15,6 +15,4 @@ Cl.new('owners').run(%w(add --target one))
|
|
|
15
15
|
|
|
16
16
|
# Output:
|
|
17
17
|
#
|
|
18
|
-
# "one"
|
|
19
|
-
# {:target=>:to}
|
|
20
|
-
|
|
18
|
+
# {:to=>"one", :deprecations=>{:target=>:to}}
|
data/examples/readme/downcase
CHANGED
data/examples/readme/enum
CHANGED
|
@@ -7,7 +7,7 @@ class Add < Cl::Cmd
|
|
|
7
7
|
opt '--to GROUP', enum: %w(one two)
|
|
8
8
|
|
|
9
9
|
def run
|
|
10
|
-
p to
|
|
10
|
+
p to: to
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -15,12 +15,17 @@ Cl.new('owners').run(%w(add --to one))
|
|
|
15
15
|
|
|
16
16
|
# Output:
|
|
17
17
|
#
|
|
18
|
-
# "one"
|
|
18
|
+
# {:to=>"one"}
|
|
19
19
|
|
|
20
20
|
Cl.new('owners').run(%w(add --to unknown))
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# Output:
|
|
23
|
+
#
|
|
24
|
+
# Unknown value: to=unknown (known values: one, two)
|
|
25
|
+
#
|
|
26
|
+
# Usage: owners add [options]
|
|
23
27
|
#
|
|
24
|
-
#
|
|
28
|
+
# Options:
|
|
25
29
|
#
|
|
26
|
-
#
|
|
30
|
+
# --to GROUP type: string, known values: one, two
|
|
31
|
+
# --help Get help on this command
|
data/examples/readme/example
CHANGED
|
@@ -9,9 +9,11 @@ end
|
|
|
9
9
|
|
|
10
10
|
Cl.new('owners').run(%w(add --help))
|
|
11
11
|
|
|
12
|
-
#
|
|
12
|
+
# Output:
|
|
13
13
|
#
|
|
14
|
-
#
|
|
14
|
+
# Usage: owners add [options]
|
|
15
15
|
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
16
|
+
# Options:
|
|
17
|
+
#
|
|
18
|
+
# --to GROUP type: string, e.g.: group-one
|
|
19
|
+
# --help Get help on this command
|
data/examples/readme/format
CHANGED
|
@@ -7,7 +7,7 @@ class Add < Cl::Cmd
|
|
|
7
7
|
opt '--to GROUP', format: /^\w+$/
|
|
8
8
|
|
|
9
9
|
def run
|
|
10
|
-
p to
|
|
10
|
+
p to: to
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -15,15 +15,17 @@ Cl.new('owners').run(%w(add --to one))
|
|
|
15
15
|
|
|
16
16
|
# Output:
|
|
17
17
|
#
|
|
18
|
-
# "one"
|
|
18
|
+
# {:to=>"one"}
|
|
19
19
|
|
|
20
20
|
Cl.new('owners').run(['add', '--to', 'does not match!'])
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# Output:
|
|
23
|
+
#
|
|
24
|
+
# Invalid format: to (format: /^\w+$/)
|
|
23
25
|
#
|
|
24
|
-
#
|
|
26
|
+
# Usage: owners add [options]
|
|
25
27
|
#
|
|
26
|
-
#
|
|
28
|
+
# Options:
|
|
27
29
|
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
+
# --to GROUP type: string, format: /^\w+$/
|
|
31
|
+
# --help Get help on this command
|
data/examples/readme/internal
CHANGED
|
@@ -3,6 +3,8 @@ $: << File.expand_path('lib')
|
|
|
3
3
|
|
|
4
4
|
require 'cl'
|
|
5
5
|
|
|
6
|
+
require 'cl'
|
|
7
|
+
|
|
6
8
|
class Add < Cl::Cmd
|
|
7
9
|
opt '--to GROUP'
|
|
8
10
|
opt '--hidden', internal: true
|
|
@@ -10,9 +12,11 @@ end
|
|
|
10
12
|
|
|
11
13
|
Cl.new('owners').run(%w(add --help))
|
|
12
14
|
|
|
13
|
-
#
|
|
15
|
+
# Output:
|
|
16
|
+
#
|
|
17
|
+
# Usage: owners add [options]
|
|
14
18
|
#
|
|
15
|
-
#
|
|
19
|
+
# Options:
|
|
16
20
|
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
21
|
+
# --to GROUP type: string
|
|
22
|
+
# --help Get help on this command
|
data/examples/readme/negate
CHANGED
|
@@ -12,16 +12,31 @@ class Add < Cl::Cmd
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
Cl.new('owners').run(%w(add --notifications))
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
# Output:
|
|
17
|
+
#
|
|
18
|
+
# true
|
|
16
19
|
|
|
17
20
|
Cl.new('owners').run(%w(add --no_notifications))
|
|
18
|
-
|
|
21
|
+
|
|
22
|
+
# Output:
|
|
23
|
+
#
|
|
24
|
+
# false
|
|
19
25
|
|
|
20
26
|
Cl.new('owners').run(%w(add --no-notifications))
|
|
21
|
-
|
|
27
|
+
|
|
28
|
+
# Output:
|
|
29
|
+
#
|
|
30
|
+
# false
|
|
22
31
|
|
|
23
32
|
Cl.new('owners').run(%w(add --skip_notifications))
|
|
24
|
-
|
|
33
|
+
|
|
34
|
+
# Output:
|
|
35
|
+
#
|
|
36
|
+
# false
|
|
25
37
|
|
|
26
38
|
Cl.new('owners').run(%w(add --skip-notifications))
|
|
27
|
-
|
|
39
|
+
|
|
40
|
+
# Output:
|
|
41
|
+
#
|
|
42
|
+
# false
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$: << File.expand_path('lib')
|
|
3
|
+
|
|
4
|
+
require 'cl'
|
|
5
|
+
|
|
6
|
+
class Add < Cl::Cmd
|
|
7
|
+
opt '--to GROUP', note: 'needs to be a group'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Cl.new('owners').run(%w(add --help))
|
|
11
|
+
|
|
12
|
+
# Output:
|
|
13
|
+
#
|
|
14
|
+
# Usage: owners add [options]
|
|
15
|
+
#
|
|
16
|
+
# Options:
|
|
17
|
+
#
|
|
18
|
+
# --to GROUP type: string, note: needs to be a group
|
|
19
|
+
# --help Get help on this command
|