como 0.1.1 → 0.1.2
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.
- data/CHANGELOG.rdoc +8 -0
- data/doc/Como/ArgsParseState.html +50 -50
- data/doc/Como/ComoCommon.html +9 -9
- data/doc/Como/MainOpt.html +126 -43
- data/doc/Como/Opt/ErrorWithData.html +10 -10
- data/doc/Como/Opt/InvalidOption.html +1 -1
- data/doc/Como/Opt/MissingArgument.html +1 -1
- data/doc/Como/Opt.html +767 -741
- data/doc/Como/RuleCheck.html +87 -87
- data/doc/Como/RuleDisplay.html +79 -79
- data/doc/Como/Spec.html +76 -90
- data/doc/Como.html +7 -6
- data/doc/_index.html +1 -1
- data/doc/file.CHANGELOG.html +9 -2
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +81 -75
- data/doc/top-level-namespace.html +1 -1
- data/lib/como.rb +160 -127
- data/test/como_compatible +1 -4
- data/test/como_config +4 -6
- data/test/como_options +2 -11
- data/test/como_queries +1 -4
- data/test/como_subcmd +2 -16
- data/test/como_subcmd_config +6 -9
- data/test/como_subcmd_rule +69 -0
- data/test/golden/compatible.txt +108 -97
- data/test/golden/config.txt +45 -149
- data/test/golden/options.txt +144 -115
- data/test/golden/queries.txt +13 -8
- data/test/golden/rule_1.txt +60 -39
- data/test/golden/rule_2.txt +60 -39
- data/test/golden/subcmd.txt +137 -131
- data/test/golden/subcmd_config.txt +162 -124
- data/test/golden/subcmd_rule.txt +366 -0
- data/test/test_como.rb +18 -9
- data/test/test_compatible +28 -28
- data/test/test_options +1 -0
- data/test/test_subcmd_rule +30 -0
- metadata +5 -2
data/test/como_compatible
CHANGED
@@ -20,10 +20,7 @@ Spec.defineCheckHelp( "como_compatible", "Como Tester", "2013",
|
|
20
20
|
|
21
21
|
Opt.each do |o|
|
22
22
|
puts "Given \"#{o.name}\": #{o.given}"
|
23
|
-
|
24
|
-
|
25
|
-
Opt.each_given do |o|
|
26
|
-
puts "Value \"#{o.name}\": #{o.value}"
|
23
|
+
puts "Value \"#{o.name}\": #{o.value}" if o.given && o.value
|
27
24
|
end
|
28
25
|
|
29
26
|
Opt[ 'params' ].given( true ) do |o|
|
data/test/como_config
CHANGED
@@ -15,10 +15,11 @@ Spec.command( "como_config", "Como Tester", "2013",
|
|
15
15
|
[ :multi, "dir", "-d", "Directory argument(s)." ],
|
16
16
|
[ :default, "Leftovers." ],
|
17
17
|
], {
|
18
|
-
:header => "
|
19
|
-
:footer => "
|
18
|
+
:header => "\nAdditional heading info.\n\n",
|
19
|
+
:footer => "\nAdditional footer info.\n\n",
|
20
20
|
:subcheck => false,
|
21
21
|
:check_missing => false,
|
22
|
+
:check_invalid => false,
|
22
23
|
:tab => 10,
|
23
24
|
:help_exit => false,
|
24
25
|
:error_exit => false,
|
@@ -27,10 +28,7 @@ Spec.command( "como_config", "Como Tester", "2013",
|
|
27
28
|
|
28
29
|
Opt.each do |o|
|
29
30
|
puts "Given \"#{o.name}\": #{o.given}"
|
30
|
-
|
31
|
-
|
32
|
-
Opt.each_given do |o|
|
33
|
-
puts "Value \"#{o.name}\": #{o.value}"
|
31
|
+
puts "Value \"#{o.name}\": #{o.value}" if o.given && o.value
|
34
32
|
end
|
35
33
|
|
36
34
|
Opt[ 'params' ].given( true ) do |o|
|
data/test/como_options
CHANGED
@@ -5,7 +5,7 @@ include Como
|
|
5
5
|
|
6
6
|
Spec.command( "como_options", "Como Tester", "2013",
|
7
7
|
[
|
8
|
-
[ :exclusive, "doc", nil, "Documentation." ],
|
8
|
+
[ :exclusive, "doc", nil, "Documentation for option\n\twith too much description\n\tfor one line." ],
|
9
9
|
[ :single, "file", "-f", "File argument." ],
|
10
10
|
[ :switch, "debug", nil, "Enable debugging." ],
|
11
11
|
[ :opt_single, "mode", "-m", "Mode." ],
|
@@ -19,16 +19,7 @@ Spec.command( "como_options", "Como Tester", "2013",
|
|
19
19
|
|
20
20
|
Opt.each do |o|
|
21
21
|
puts "Given \"#{o.name}\": #{o.given}"
|
22
|
-
|
23
|
-
|
24
|
-
Opt.each_given do |o|
|
25
|
-
puts "Value \"#{o.name}\": #{o.value}"
|
26
|
-
end
|
27
|
-
|
28
|
-
Opt[ 'params' ].given( true ) do |o|
|
29
|
-
o.params.each do |k,v|
|
30
|
-
puts "Param #{k}: #{v}"
|
31
|
-
end
|
22
|
+
puts "Value \"#{o.name}\": #{o.value}" if o.given && o.value
|
32
23
|
end
|
33
24
|
|
34
25
|
if Opt.external
|
data/test/como_queries
CHANGED
@@ -15,10 +15,7 @@ Spec.command( "como_queries", "Como Tester", "2013",
|
|
15
15
|
|
16
16
|
Opt.each do |o|
|
17
17
|
puts "Given \"#{o.name}\": #{o.given}"
|
18
|
-
|
19
|
-
|
20
|
-
Opt.each_given do |o|
|
21
|
-
puts "Value \"#{o.name}\": #{o.value}"
|
18
|
+
puts "Value \"#{o.name}\": #{o.value}" if o.given && o.value
|
22
19
|
end
|
23
20
|
|
24
21
|
Opt.main.suball do |o|
|
data/test/como_subcmd
CHANGED
@@ -15,11 +15,6 @@ Spec.program( "Como Tester", "2013" ) do
|
|
15
15
|
[ :subcmd, "commit", nil, "Commit (pending) changes to repo." ],
|
16
16
|
], )
|
17
17
|
|
18
|
-
checkRule do
|
19
|
-
any( 'password', 'username' )
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
18
|
subcmd( "add",
|
24
19
|
[
|
25
20
|
[ :switch, "force", "-fo", "Force operation." ],
|
@@ -27,18 +22,12 @@ Spec.program( "Como Tester", "2013" ) do
|
|
27
22
|
[ :single, "file", "-f", "File." ],
|
28
23
|
] )
|
29
24
|
|
30
|
-
|
31
|
-
checkRule do
|
32
|
-
one( 'file', 'username', inv( '-fo' ) )
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
25
|
subcmd( "rm",
|
37
26
|
[
|
38
27
|
[ :switch, "force", "-fo", "Force operation." ],
|
39
28
|
[ :opt_single, "file", "-f", "File." ],
|
40
29
|
] )
|
41
|
-
|
30
|
+
|
42
31
|
subcmd( "commit",
|
43
32
|
[
|
44
33
|
[ :switch, "quiet", "-q", "Quiet operation." ],
|
@@ -53,10 +42,7 @@ def displayOptions( opt )
|
|
53
42
|
|
54
43
|
opt.each do |o|
|
55
44
|
puts " Given \"#{o.name}\": #{o.given}"
|
56
|
-
|
57
|
-
|
58
|
-
opt.each_given do |o|
|
59
|
-
puts " Value \"#{o.name}\": #{o.value}"
|
45
|
+
puts " Value \"#{o.name}\": #{o.value}" if o.given && o.value
|
60
46
|
end
|
61
47
|
|
62
48
|
sub = opt.givenSubcmd
|
data/test/como_subcmd_config
CHANGED
@@ -5,8 +5,8 @@ include Como
|
|
5
5
|
|
6
6
|
Spec.program( "Como Tester", "2013",
|
7
7
|
{
|
8
|
-
:header => "
|
9
|
-
:footer => "
|
8
|
+
:header => "\nAdditional heading info.\n\n",
|
9
|
+
:footer => "\nAdditional footer info.\n\n",
|
10
10
|
:subcheck => false,
|
11
11
|
:check_missing => false,
|
12
12
|
:tab => 10,
|
@@ -38,7 +38,7 @@ Spec.program( "Como Tester", "2013",
|
|
38
38
|
checkRule do
|
39
39
|
one( 'file', 'username', inv( '-fo' ) )
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
|
43
43
|
subcmd( "rm", [
|
44
44
|
[ :exclusive, "help", "-hm", "Help for me." ],
|
@@ -49,7 +49,7 @@ Spec.program( "Como Tester", "2013",
|
|
49
49
|
:header => nil,
|
50
50
|
:footer => nil,
|
51
51
|
} )
|
52
|
-
|
52
|
+
|
53
53
|
subcmd( "commit", [
|
54
54
|
[ :switch, "quiet", "-q", "Quiet operation." ],
|
55
55
|
[ :opt_single, "username", "-u", "Username." ],
|
@@ -59,7 +59,7 @@ Spec.program( "Como Tester", "2013",
|
|
59
59
|
:help_exit => true,
|
60
60
|
:error_exit => false,
|
61
61
|
} )
|
62
|
-
|
62
|
+
|
63
63
|
end
|
64
64
|
|
65
65
|
|
@@ -69,10 +69,7 @@ def displayOptions( opt )
|
|
69
69
|
|
70
70
|
opt.each do |o|
|
71
71
|
puts " Given \"#{o.name}\": #{o.given}"
|
72
|
-
|
73
|
-
|
74
|
-
opt.each_given do |o|
|
75
|
-
puts " Value \"#{o.name}\": #{o.value}"
|
72
|
+
puts " Value \"#{o.name}\": #{o.value}" if o.given && o.value
|
76
73
|
end
|
77
74
|
|
78
75
|
sub = opt.givenSubcmd
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "../lib/como"
|
4
|
+
include Como
|
5
|
+
|
6
|
+
Spec.program( "Como Tester", "2013" ) do
|
7
|
+
|
8
|
+
subcmd( "como_subcmd",
|
9
|
+
[
|
10
|
+
[ :opt_single, "password", "-p", "User password." ],
|
11
|
+
[ :opt_multi, "username", "-u", "Username(s)." ],
|
12
|
+
[ :silent, "terminator","-", "Terminator." ],
|
13
|
+
[ :subcmd, "add", nil, "Add file to repo." ],
|
14
|
+
[ :subcmd, "rm", nil, "Remove file from repo." ],
|
15
|
+
[ :subcmd, "commit", nil, "Commit (pending) changes to repo." ],
|
16
|
+
], )
|
17
|
+
|
18
|
+
checkRule do
|
19
|
+
any( 'password', 'username' )
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
subcmd( "add",
|
24
|
+
[
|
25
|
+
[ :switch, "force", "-fo", "Force operation." ],
|
26
|
+
[ :opt_single, "username", "-u", "Username." ],
|
27
|
+
[ :single, "file", "-f", "File." ],
|
28
|
+
] )
|
29
|
+
|
30
|
+
|
31
|
+
checkRule do
|
32
|
+
one( 'file', 'username', inv( '-fo' ) )
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
subcmd( "rm",
|
37
|
+
[
|
38
|
+
[ :switch, "force", "-fo", "Force operation." ],
|
39
|
+
[ :opt_single, "file", "-f", "File." ],
|
40
|
+
] )
|
41
|
+
|
42
|
+
subcmd( "commit",
|
43
|
+
[
|
44
|
+
[ :switch, "quiet", "-q", "Quiet operation." ],
|
45
|
+
[ :opt_single, "username", "-u", "Username." ],
|
46
|
+
[ :default, "File(s) to commit." ],
|
47
|
+
] )
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
def displayOptions( opt )
|
52
|
+
puts "Options for: #{opt.name}"
|
53
|
+
|
54
|
+
opt.each do |o|
|
55
|
+
puts " Given \"#{o.name}\": #{o.given}"
|
56
|
+
puts " Value \"#{o.name}\": #{o.value}" if o.given && o.value
|
57
|
+
end
|
58
|
+
|
59
|
+
sub = opt.givenSubcmd
|
60
|
+
displayOptions( sub ) if sub
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
displayOptions( Opt.main )
|
65
|
+
|
66
|
+
|
67
|
+
if Opt.external
|
68
|
+
puts "External: #{Opt.external}"
|
69
|
+
end
|