como 0.0.2 → 0.1.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.
- data/CHANGELOG.rdoc +12 -0
- data/README.rdoc +11 -5
- data/Rakefile +6 -1
- data/doc/Como/ArgsParseState.html +912 -0
- data/doc/Como/ComoCommon.html +305 -0
- data/doc/Como/MainOpt.html +636 -0
- data/doc/Como/MasterOpt.html +636 -0
- data/doc/Como/Opt/ErrorWithData.html +304 -0
- data/doc/Como/Opt/InvalidOption.html +158 -0
- data/doc/Como/Opt/MissingArgument.html +158 -0
- data/doc/Como/Opt.html +6098 -0
- data/doc/Como/RuleCheck.html +933 -0
- data/doc/Como/RuleDisplay.html +1193 -0
- data/doc/Como/Spec.html +1750 -0
- data/doc/Como.html +625 -0
- data/doc/_index.html +242 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file.CHANGELOG.html +90 -0
- data/doc/file.README.html +94 -0
- data/doc/file.como.html +1962 -0
- data/doc/file_list.html +58 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +94 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +838 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/como.rb +1660 -661
- data/test/como_compatible +37 -0
- data/test/como_config +44 -0
- data/test/como_options +36 -0
- data/test/como_queries +44 -0
- data/test/como_rule_1 +28 -0
- data/test/como_rule_2 +28 -0
- data/test/como_subcmd +72 -0
- data/test/como_subcmd_config +88 -0
- data/test/golden/compatible.txt +438 -0
- data/test/golden/config.txt +319 -0
- data/test/golden/options.txt +438 -0
- data/test/golden/queries.txt +78 -0
- data/test/golden/rule_1.txt +454 -0
- data/test/golden/rule_2.txt +476 -0
- data/test/golden/subcmd.txt +360 -0
- data/test/golden/subcmd_config.txt +534 -0
- data/test/test_como.rb +22 -328
- data/test/test_compatible +28 -0
- data/test/test_config +12 -0
- data/test/test_options +28 -0
- data/test/test_queries +7 -0
- data/test/test_rule_1 +27 -0
- data/test/test_rule_2 +27 -0
- data/test/test_subcmd +30 -0
- data/test/test_subcmd_config +31 -0
- metadata +62 -6
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "como"
|
4
|
+
include Como
|
5
|
+
|
6
|
+
Spec.defineCheckHelp( "como_compatible", "Como Tester", "2013",
|
7
|
+
[
|
8
|
+
[ :silent, "help", "-h", "Display usage info." ],
|
9
|
+
[ :exclusive, "doc", nil, "Documentation." ],
|
10
|
+
[ :single, "file", "-f", "File argument." ],
|
11
|
+
[ :switch, "debug", nil, "Enable debugging." ],
|
12
|
+
[ :opt_single, "mode", "-m", "Mode." ],
|
13
|
+
[ :opt_multi, "params", nil, "Parameters." ],
|
14
|
+
[ :opt_any, "types", "-t", "Types." ],
|
15
|
+
[ :silent, "terminator", "-", "The terminator." ],
|
16
|
+
[ :multi, "dir", "-d", "Directory argument(s)." ],
|
17
|
+
[ :default, "Leftovers." ],
|
18
|
+
] )
|
19
|
+
|
20
|
+
|
21
|
+
Opt.each do |o|
|
22
|
+
puts "Given \"#{o.name}\": #{o.given}"
|
23
|
+
end
|
24
|
+
|
25
|
+
Opt.each_given do |o|
|
26
|
+
puts "Value \"#{o.name}\": #{o.value}"
|
27
|
+
end
|
28
|
+
|
29
|
+
Opt[ 'params' ].given( true ) do |o|
|
30
|
+
o.params.each do |k,v|
|
31
|
+
puts "Param #{k}: #{v}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
if Opt.external
|
36
|
+
puts "External: #{Opt.external}"
|
37
|
+
end
|
data/test/como_config
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "como"
|
4
|
+
include Como
|
5
|
+
|
6
|
+
Spec.command( "como_config", "Como Tester", "2013",
|
7
|
+
[
|
8
|
+
[ :exclusive, "doc", nil, "Documentation." ],
|
9
|
+
[ :single, "file", "-f", "File argument." ],
|
10
|
+
[ :switch, "debug", nil, "Enable debugging." ],
|
11
|
+
[ :opt_single, "mode", "-m", "Mode." ],
|
12
|
+
[ :opt_multi, "params", nil, "Parameters." ],
|
13
|
+
[ :opt_any, "types", "-t", "Types." ],
|
14
|
+
[ :silent, "terminator", "-", "The terminator." ],
|
15
|
+
[ :multi, "dir", "-d", "Directory argument(s)." ],
|
16
|
+
[ :default, "Leftovers." ],
|
17
|
+
], {
|
18
|
+
:header => "Addition heading info.",
|
19
|
+
:footer => "Addition footer info.",
|
20
|
+
:subcheck => false,
|
21
|
+
:check_missing => false,
|
22
|
+
:tab => 10,
|
23
|
+
:help_exit => false,
|
24
|
+
:error_exit => false,
|
25
|
+
} )
|
26
|
+
|
27
|
+
|
28
|
+
Opt.each do |o|
|
29
|
+
puts "Given \"#{o.name}\": #{o.given}"
|
30
|
+
end
|
31
|
+
|
32
|
+
Opt.each_given do |o|
|
33
|
+
puts "Value \"#{o.name}\": #{o.value}"
|
34
|
+
end
|
35
|
+
|
36
|
+
Opt[ 'params' ].given( true ) do |o|
|
37
|
+
o.params.each do |k,v|
|
38
|
+
puts "Param #{k}: #{v}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
if Opt.external
|
43
|
+
puts "External: #{Opt.external}"
|
44
|
+
end
|
data/test/como_options
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "como"
|
4
|
+
include Como
|
5
|
+
|
6
|
+
Spec.command( "como_options", "Como Tester", "2013",
|
7
|
+
[
|
8
|
+
[ :exclusive, "doc", nil, "Documentation." ],
|
9
|
+
[ :single, "file", "-f", "File argument." ],
|
10
|
+
[ :switch, "debug", nil, "Enable debugging." ],
|
11
|
+
[ :opt_single, "mode", "-m", "Mode." ],
|
12
|
+
[ :opt_multi, "params", nil, "Parameters." ],
|
13
|
+
[ :opt_any, "types", "-t", "Types." ],
|
14
|
+
[ :silent, "terminator", "-", "The terminator." ],
|
15
|
+
[ :multi, "dir", "-d", "Directory argument(s)." ],
|
16
|
+
[ :default, "Leftovers." ],
|
17
|
+
] )
|
18
|
+
|
19
|
+
|
20
|
+
Opt.each do |o|
|
21
|
+
puts "Given \"#{o.name}\": #{o.given}"
|
22
|
+
end
|
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
|
32
|
+
end
|
33
|
+
|
34
|
+
if Opt.external
|
35
|
+
puts "External: #{Opt.external}"
|
36
|
+
end
|
data/test/como_queries
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "como"
|
4
|
+
include Como
|
5
|
+
|
6
|
+
Spec.command( "como_queries", "Como Tester", "2013",
|
7
|
+
[
|
8
|
+
[ :exclusive, "doc", nil, "Documentation." ],
|
9
|
+
[ :switch, "debug", nil, "Enable debugging." ],
|
10
|
+
[ :opt_single, "mode", "-m", "Mode." ],
|
11
|
+
[ :opt_multi, "params", nil, "Parameters." ],
|
12
|
+
[ :opt_any, "types", "-t", "Types." ],
|
13
|
+
[ :default, "Leftovers." ],
|
14
|
+
] )
|
15
|
+
|
16
|
+
Opt.each do |o|
|
17
|
+
puts "Given \"#{o.name}\": #{o.given}"
|
18
|
+
end
|
19
|
+
|
20
|
+
Opt.each_given do |o|
|
21
|
+
puts "Value \"#{o.name}\": #{o.value}"
|
22
|
+
end
|
23
|
+
|
24
|
+
Opt.main.suball do |o|
|
25
|
+
puts "Name: #{o.name}"
|
26
|
+
puts " Value: #{~o}" if o.given
|
27
|
+
end
|
28
|
+
|
29
|
+
puts "Given count: #{Opt.main.givenCount}"
|
30
|
+
|
31
|
+
puts "Mode value: #{Opt[ 'mode' ].apply( "default mode" )}"
|
32
|
+
|
33
|
+
Opt[ 'debug' ].given? do
|
34
|
+
puts "Debug option set."
|
35
|
+
end
|
36
|
+
|
37
|
+
Opt[ 'types' ].given do |value|
|
38
|
+
puts "Types values: #{value}"
|
39
|
+
end
|
40
|
+
|
41
|
+
if Opt[:default].given
|
42
|
+
puts "Default with \":default\": #{Opt[:default].value}"
|
43
|
+
puts "Default with \"nil\": #{Opt[nil].value}"
|
44
|
+
end
|
data/test/como_rule_1
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "como"
|
4
|
+
include Como
|
5
|
+
|
6
|
+
Spec.command( "como_rule_1", "Como Tester", "2013",
|
7
|
+
[
|
8
|
+
[ :exclusive, "doc", nil, "Documentation." ],
|
9
|
+
[ :opt_single, "file", "-f", "File argument." ],
|
10
|
+
[ :switch, "debug", nil, "Enable debugging." ],
|
11
|
+
[ :opt_single, "mode", "-m", "Mode." ],
|
12
|
+
[ :opt_multi, "params", nil, "Parameters." ],
|
13
|
+
[ :opt_any, "types", "-t", "Types." ],
|
14
|
+
[ :silent, "terminator", "-", "The terminator." ],
|
15
|
+
[ :opt_multi, "dir", "-d", "Directory argument(s)." ],
|
16
|
+
[ :default, "Leftovers." ],
|
17
|
+
] )
|
18
|
+
|
19
|
+
|
20
|
+
Spec.checkRule do
|
21
|
+
one(
|
22
|
+
none,
|
23
|
+
any( 'debug', 'mode' ),
|
24
|
+
incr( 'params', 'types' ),
|
25
|
+
follow( '-', nil, '-d' ),
|
26
|
+
all( one( 'dir' ), one( 'file' ) ),
|
27
|
+
)
|
28
|
+
end
|
data/test/como_rule_2
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "como"
|
4
|
+
include Como
|
5
|
+
|
6
|
+
Spec.command( "como_rule_2", "Como Tester", "2013",
|
7
|
+
[
|
8
|
+
[ :exclusive, "doc", nil, "Documentation." ],
|
9
|
+
[ :opt_single, "file", "-f", "File argument." ],
|
10
|
+
[ :switch, "debug", nil, "Enable debugging." ],
|
11
|
+
[ :opt_single, "mode", "-m", "Mode." ],
|
12
|
+
[ :opt_multi, "params", nil, "Parameters." ],
|
13
|
+
[ :opt_any, "types", "-t", "Types." ],
|
14
|
+
[ :silent, "terminator", "-", "The terminator." ],
|
15
|
+
[ :opt_multi, "dir", "-d", "Directory argument(s)." ],
|
16
|
+
[ :default, "Leftovers." ],
|
17
|
+
] )
|
18
|
+
|
19
|
+
|
20
|
+
Spec.checkRule do
|
21
|
+
one(
|
22
|
+
any( 'debug', 'mode' ),
|
23
|
+
follow( '-', nil, '-d', meh( 'debug' ) ),
|
24
|
+
incr( 'params', 'types' ),
|
25
|
+
none,
|
26
|
+
all( one( 'dir' ), one( 'file' ) ),
|
27
|
+
)
|
28
|
+
end
|
data/test/como_subcmd
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "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
|
+
end
|
57
|
+
|
58
|
+
opt.each_given do |o|
|
59
|
+
puts " Value \"#{o.name}\": #{o.value}"
|
60
|
+
end
|
61
|
+
|
62
|
+
sub = opt.givenSubcmd
|
63
|
+
displayOptions( sub ) if sub
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
displayOptions( Opt.main )
|
68
|
+
|
69
|
+
|
70
|
+
if Opt.external
|
71
|
+
puts "External: #{Opt.external}"
|
72
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "como"
|
4
|
+
include Como
|
5
|
+
|
6
|
+
Spec.program( "Como Tester", "2013",
|
7
|
+
{
|
8
|
+
:header => "Addition heading info.",
|
9
|
+
:footer => "Addition footer info.",
|
10
|
+
:subcheck => false,
|
11
|
+
:check_missing => false,
|
12
|
+
:tab => 10,
|
13
|
+
:help_exit => false,
|
14
|
+
:error_exit => false,
|
15
|
+
} ) do
|
16
|
+
|
17
|
+
subcmd( "como_subcmd_config", [
|
18
|
+
[ :opt_single, "password", "-p", "User password." ],
|
19
|
+
[ :opt_multi, "username", "-u", "Username(s)." ],
|
20
|
+
[ :silent, "terminator","-", "Terminator." ],
|
21
|
+
[ :subcmd, "add", nil, "Add file to repo." ],
|
22
|
+
[ :subcmd, "rm", nil, "Remove file from repo." ],
|
23
|
+
[ :subcmd, "commit", nil, "Commit (pending) changes to repo." ],
|
24
|
+
], )
|
25
|
+
|
26
|
+
checkRule do
|
27
|
+
any( 'password', 'username' )
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
subcmd( "add", [
|
32
|
+
[ :switch, "force", "-fo", "Force operation." ],
|
33
|
+
[ :opt_single, "username", "-u", "Username." ],
|
34
|
+
[ :single, "file", "-f", "File." ],
|
35
|
+
], { :rulehelp => true, :help_exit => true } )
|
36
|
+
|
37
|
+
|
38
|
+
checkRule do
|
39
|
+
one( 'file', 'username', inv( '-fo' ) )
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
subcmd( "rm", [
|
44
|
+
[ :exclusive, "help", "-hm", "Help for me." ],
|
45
|
+
[ :switch, "force", "-fo", "Force operation." ],
|
46
|
+
[ :opt_single, "file", "-f", "File." ],
|
47
|
+
], {
|
48
|
+
:autohelp => false,
|
49
|
+
:header => nil,
|
50
|
+
:footer => nil,
|
51
|
+
} )
|
52
|
+
|
53
|
+
subcmd( "commit", [
|
54
|
+
[ :switch, "quiet", "-q", "Quiet operation." ],
|
55
|
+
[ :opt_single, "username", "-u", "Username." ],
|
56
|
+
[ :default, "File(s) to commit." ],
|
57
|
+
], {
|
58
|
+
:tab => 14,
|
59
|
+
:help_exit => true,
|
60
|
+
:error_exit => false,
|
61
|
+
} )
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
def displayOptions( opt )
|
68
|
+
puts "Options for: #{opt.name}"
|
69
|
+
|
70
|
+
opt.each do |o|
|
71
|
+
puts " Given \"#{o.name}\": #{o.given}"
|
72
|
+
end
|
73
|
+
|
74
|
+
opt.each_given do |o|
|
75
|
+
puts " Value \"#{o.name}\": #{o.value}"
|
76
|
+
end
|
77
|
+
|
78
|
+
sub = opt.givenSubcmd
|
79
|
+
displayOptions( sub ) if sub
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
displayOptions( Opt.main )
|
84
|
+
|
85
|
+
|
86
|
+
if Opt.external
|
87
|
+
puts "External: #{Opt.external}"
|
88
|
+
end
|