optiflag 0.6 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/ReleaseNotes.txt +35 -0
  2. data/doc/classes/OptiFlag.html +439 -0
  3. data/doc/classes/OptiFlag.src/M000001.html +49 -0
  4. data/doc/classes/OptiFlag.src/M000002.html +49 -0
  5. data/doc/classes/OptiFlag.src/M000003.html +30 -0
  6. data/doc/classes/OptiFlag/Flagset.html +459 -0
  7. data/doc/classes/OptiFlag/Flagset.src/M000003.html +45 -0
  8. data/doc/classes/OptiFlag/Flagset.src/M000004.html +45 -0
  9. data/doc/classes/OptiFlag/Flagset.src/M000005.html +18 -0
  10. data/doc/classes/OptiFlag/Flagset.src/M000006.html +20 -0
  11. data/doc/classes/OptiFlag/Flagset.src/M000007.html +35 -0
  12. data/doc/classes/OptiFlag/Flagset.src/M000008.html +23 -0
  13. data/doc/classes/OptiFlag/Flagset.src/M000009.html +24 -0
  14. data/doc/classes/OptiFlag/Flagset.src/M000010.html +28 -0
  15. data/doc/classes/OptiFlag/Flagset.src/M000011.html +20 -0
  16. data/doc/classes/OptiFlag/Flagset.src/M000012.html +24 -0
  17. data/doc/classes/OptiFlag/Flagset.src/M000013.html +24 -0
  18. data/doc/classes/OptiFlag/Flagset.src/M000014.html +32 -0
  19. data/doc/classes/OptiFlag/Flagset.src/M000015.html +25 -0
  20. data/doc/classes/OptiFlag/Flagset.src/M000016.html +53 -0
  21. data/doc/classes/OptiFlag/Flagset.src/M000017.html +53 -0
  22. data/doc/classes/OptiFlag/Flagset/EachFlag.html +930 -0
  23. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000024.html +36 -0
  24. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000025.html +18 -0
  25. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000026.html +36 -0
  26. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000027.html +36 -0
  27. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000028.html +18 -0
  28. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000029.html +18 -0
  29. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000030.html +19 -0
  30. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000031.html +19 -0
  31. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000032.html +18 -0
  32. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000033.html +18 -0
  33. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000034.html +18 -0
  34. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000035.html +22 -0
  35. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000036.html +19 -0
  36. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000037.html +18 -0
  37. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000038.html +18 -0
  38. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000039.html +18 -0
  39. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000040.html +18 -0
  40. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000041.html +18 -0
  41. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000042.html +18 -0
  42. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000043.html +19 -0
  43. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000044.html +18 -0
  44. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000045.html +19 -0
  45. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000046.html +18 -0
  46. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000047.html +18 -0
  47. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000048.html +18 -0
  48. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000049.html +18 -0
  49. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000050.html +18 -0
  50. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000051.html +18 -0
  51. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000052.html +20 -0
  52. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000053.html +18 -0
  53. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000054.html +18 -0
  54. data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000055.html +22 -0
  55. data/doc/classes/OptiFlag/Flagset/Errors.html +192 -0
  56. data/doc/classes/OptiFlag/Flagset/Errors.src/M000021.html +18 -0
  57. data/doc/classes/OptiFlag/Flagset/Errors.src/M000022.html +19 -0
  58. data/doc/classes/OptiFlag/Flagset/Errors.src/M000023.html +18 -0
  59. data/doc/classes/OptiFlag/Flagset/Errors.src/M000024.html +18 -0
  60. data/doc/classes/OptiFlag/Flagset/Errors.src/M000025.html +19 -0
  61. data/doc/classes/OptiFlag/Flagset/Errors.src/M000026.html +36 -0
  62. data/doc/classes/OptiFlag/Flagset/Help.html +125 -0
  63. data/doc/classes/OptiFlag/Flagset/Help/Bundle.html +160 -0
  64. data/doc/classes/OptiFlag/Flagset/Help/Bundle.src/M000018.html +18 -0
  65. data/doc/classes/OptiFlag/Flagset/Help/Bundle.src/M000019.html +18 -0
  66. data/doc/classes/OptiFlag/Flagset/Help/StandardHelpBundle.html +118 -0
  67. data/doc/classes/OptiFlag/Flagset/NewInterface.html +296 -0
  68. data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000017.html +18 -0
  69. data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000018.html +18 -0
  70. data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000019.html +18 -0
  71. data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000020.html +18 -0
  72. data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000021.html +18 -0
  73. data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000022.html +18 -0
  74. data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000023.html +18 -0
  75. data/doc/created.rid +1 -0
  76. data/doc/files/optiflag-help_rb.html +101 -0
  77. data/doc/files/optiflag-parse_rb.html +101 -0
  78. data/doc/files/optiflag_rb.html +167 -0
  79. data/doc/files/optiflag_rb.src/M000001.html +18 -0
  80. data/doc/fr_class_index.html +34 -0
  81. data/doc/fr_file_index.html +29 -0
  82. data/doc/fr_method_index.html +82 -0
  83. data/doc/index.html +24 -0
  84. data/doc/rdoc-style.css +208 -0
  85. data/examples/example_1.rb +21 -0
  86. data/examples/example_1_1.rb +21 -0
  87. data/{doc/example → examples}/example_1_2.rb +8 -8
  88. data/examples/example_2.rb +31 -0
  89. data/{doc/example → examples}/example_2_1.rb +4 -4
  90. data/{doc/example → examples}/example_2_2.rb +7 -5
  91. data/{doc/example → examples}/example_2_3.rb +9 -9
  92. data/{doc/example → examples}/example_2_4.rb +4 -4
  93. data/{doc/example → examples}/example_2_5.rb +4 -4
  94. data/{doc/example → examples}/example_2_6.rb +6 -6
  95. data/{doc/example → examples}/example_3.rb +7 -6
  96. data/examples/example_6.rb +20 -0
  97. data/{doc/example → examples}/example_7.rb +5 -4
  98. data/examples/example_8.rb +26 -0
  99. data/optiflag-help.rb +42 -0
  100. data/optiflag-parse.rb +281 -0
  101. data/optiflag.gemspec +4 -3
  102. data/optiflag.rb +972 -0
  103. data/quick.rb +12 -0
  104. data/{test → testcases}/tc_advanced_usage_helping.rb +4 -0
  105. data/{test → testcases}/tc_basic_alternate_forms.rb +0 -0
  106. data/{test → testcases}/tc_basic_char_flags.rb +12 -12
  107. data/{test → testcases}/tc_basic_optional_flag.rb +0 -0
  108. data/{test → testcases}/tc_basic_parsing.rb +0 -0
  109. data/{test → testcases}/tc_basic_usage_helping.rb +0 -0
  110. data/{test → testcases}/tc_basic_value_validation.rb +0 -0
  111. data/{test → testcases}/tc_bug_one.rb +0 -0
  112. data/{test → testcases}/tc_bug_two.rb +0 -0
  113. data/{test → testcases}/tc_change_symbols.rb +0 -0
  114. data/{test → testcases}/tc_enumerated_value_validation.rb +0 -0
  115. data/{test → testcases}/tc_flagall.rb +4 -0
  116. data/{test → testcases}/tc_flagless_arg.rb +0 -0
  117. data/{test → testcases}/tc_keyword.rb +0 -0
  118. data/testcases/tc_new_basic_parsing.rb +51 -0
  119. data/testcases/tc_poro_tester.rb +30 -0
  120. data/{test → testcases}/tc_values_as_hash.rb +0 -0
  121. metadata +152 -52
  122. data/doc/example/example_1.rb +0 -30
  123. data/doc/example/example_1_1.rb +0 -27
  124. data/doc/example/example_2.rb +0 -28
  125. data/doc/example/example_4.rb +0 -12
  126. data/doc/example/example_5.rb +0 -26
  127. data/doc/example/example_6.rb +0 -17
  128. data/lib/optiflag.rb +0 -860
@@ -0,0 +1,208 @@
1
+
2
+ body {
3
+ font-family: Verdana,Arial,Helvetica,sans-serif;
4
+ font-size: 90%;
5
+ margin: 0;
6
+ margin-left: 40px;
7
+ padding: 0;
8
+ background: white;
9
+ }
10
+
11
+ h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
+ h1 { font-size: 150%; }
13
+ h2,h3,h4 { margin-top: 1em; }
14
+
15
+ a { background: #eef; color: #039; text-decoration: none; }
16
+ a:hover { background: #039; color: #eef; }
17
+
18
+ /* Override the base stylesheet's Anchor inside a table cell */
19
+ td > a {
20
+ background: transparent;
21
+ color: #039;
22
+ text-decoration: none;
23
+ }
24
+
25
+ /* and inside a section title */
26
+ .section-title > a {
27
+ background: transparent;
28
+ color: #eee;
29
+ text-decoration: none;
30
+ }
31
+
32
+ /* === Structural elements =================================== */
33
+
34
+ div#index {
35
+ margin: 0;
36
+ margin-left: -40px;
37
+ padding: 0;
38
+ font-size: 90%;
39
+ }
40
+
41
+
42
+ div#index a {
43
+ margin-left: 0.7em;
44
+ }
45
+
46
+ div#index .section-bar {
47
+ margin-left: 0px;
48
+ padding-left: 0.7em;
49
+ background: #ccc;
50
+ font-size: small;
51
+ }
52
+
53
+
54
+ div#classHeader, div#fileHeader {
55
+ width: auto;
56
+ color: white;
57
+ padding: 0.5em 1.5em 0.5em 1.5em;
58
+ margin: 0;
59
+ margin-left: -40px;
60
+ border-bottom: 3px solid #006;
61
+ }
62
+
63
+ div#classHeader a, div#fileHeader a {
64
+ background: inherit;
65
+ color: white;
66
+ }
67
+
68
+ div#classHeader td, div#fileHeader td {
69
+ background: inherit;
70
+ color: white;
71
+ }
72
+
73
+
74
+ div#fileHeader {
75
+ background: #057;
76
+ }
77
+
78
+ div#classHeader {
79
+ background: #048;
80
+ }
81
+
82
+
83
+ .class-name-in-header {
84
+ font-size: 180%;
85
+ font-weight: bold;
86
+ }
87
+
88
+
89
+ div#bodyContent {
90
+ padding: 0 1.5em 0 1.5em;
91
+ }
92
+
93
+ div#description {
94
+ padding: 0.5em 1.5em;
95
+ background: #efefef;
96
+ border: 1px dotted #999;
97
+ }
98
+
99
+ div#description h1,h2,h3,h4,h5,h6 {
100
+ color: #125;;
101
+ background: transparent;
102
+ }
103
+
104
+ div#validator-badges {
105
+ text-align: center;
106
+ }
107
+ div#validator-badges img { border: 0; }
108
+
109
+ div#copyright {
110
+ color: #333;
111
+ background: #efefef;
112
+ font: 0.75em sans-serif;
113
+ margin-top: 5em;
114
+ margin-bottom: 0;
115
+ padding: 0.5em 2em;
116
+ }
117
+
118
+
119
+ /* === Classes =================================== */
120
+
121
+ table.header-table {
122
+ color: white;
123
+ font-size: small;
124
+ }
125
+
126
+ .type-note {
127
+ font-size: small;
128
+ color: #DEDEDE;
129
+ }
130
+
131
+ .xxsection-bar {
132
+ background: #eee;
133
+ color: #333;
134
+ padding: 3px;
135
+ }
136
+
137
+ .section-bar {
138
+ color: #333;
139
+ border-bottom: 1px solid #999;
140
+ margin-left: -20px;
141
+ }
142
+
143
+
144
+ .section-title {
145
+ background: #79a;
146
+ color: #eee;
147
+ padding: 3px;
148
+ margin-top: 2em;
149
+ margin-left: -30px;
150
+ border: 1px solid #999;
151
+ }
152
+
153
+ .top-aligned-row { vertical-align: top }
154
+ .bottom-aligned-row { vertical-align: bottom }
155
+
156
+ /* --- Context section classes ----------------------- */
157
+
158
+ .context-row { }
159
+ .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
+ .context-item-value { font-size: small; color: #448; }
161
+ .context-item-desc { color: #333; padding-left: 2em; }
162
+
163
+ /* --- Method classes -------------------------- */
164
+ .method-detail {
165
+ background: #efefef;
166
+ padding: 0;
167
+ margin-top: 0.5em;
168
+ margin-bottom: 1em;
169
+ border: 1px dotted #ccc;
170
+ }
171
+ .method-heading {
172
+ color: black;
173
+ background: #ccc;
174
+ border-bottom: 1px solid #666;
175
+ padding: 0.2em 0.5em 0 0.5em;
176
+ }
177
+ .method-signature { color: black; background: inherit; }
178
+ .method-name { font-weight: bold; }
179
+ .method-args { font-style: italic; }
180
+ .method-description { padding: 0 0.5em 0 0.5em; }
181
+
182
+ /* --- Source code sections -------------------- */
183
+
184
+ a.source-toggle { font-size: 90%; }
185
+ div.method-source-code {
186
+ background: #262626;
187
+ color: #ffdead;
188
+ margin: 1em;
189
+ padding: 0.5em;
190
+ border: 1px dashed #999;
191
+ overflow: hidden;
192
+ }
193
+
194
+ div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
+
196
+ /* --- Ruby keyword styles --------------------- */
197
+
198
+ .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
+
200
+ .ruby-constant { color: #7fffd4; background: transparent; }
201
+ .ruby-keyword { color: #00ffff; background: transparent; }
202
+ .ruby-ivar { color: #eedd82; background: transparent; }
203
+ .ruby-operator { color: #00ffee; background: transparent; }
204
+ .ruby-identifier { color: #ffdead; background: transparent; }
205
+ .ruby-node { color: #ffa07a; background: transparent; }
206
+ .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
+ .ruby-regexp { color: #ffa07a; background: transparent; }
208
+ .ruby-value { color: #7fffd4; background: transparent; }
@@ -0,0 +1,21 @@
1
+ require 'optiflag'
2
+ # Title: Four required flags (no ordering)
3
+ # Description: The simplest example, where we add four required flags, which have no ordering.
4
+ module Example extend OptiFlagSet
5
+ flag "dir"
6
+ flag "log"
7
+ flag "username"
8
+ flag "password"
9
+
10
+ and_process!
11
+ end
12
+
13
+ # Some code to _use_ the values
14
+ puts "User has input:#{ ARGV.flags.dir } for dir"
15
+ puts "User has input:#{ ARGV.flags.log } for log"
16
+ puts "User has input:#{ ARGV.flags.username } for username"
17
+ puts "User has input:#{ ARGV.flags.password } for password"
18
+
19
+ # Try the following inputs
20
+ # ruby example_1.rb
21
+ #h# ruby example_1.rb -log logdirectory -dir directory -username me -password fluffy
@@ -0,0 +1,21 @@
1
+ require 'optiflag'
2
+ # Title: Four required flags (no ordering), accessing via the module name.
3
+ # Description: Exact same as the previous, except we show that the module name may be used to access the flag values, if you don't want to get them from ARGV. (It's a style thing)
4
+ module Example extend OptiFlagSet
5
+ flag "dir"
6
+ flag "log"
7
+ flag "username"
8
+ flag "password"
9
+
10
+ and_process!
11
+ end
12
+
13
+ # Some code to _use_ the values
14
+ puts "User has input:#{ Example.flags.dir } for dir"
15
+ puts "User has input:#{ Example.flags.log } for log"
16
+ puts "User has input:#{ Example.flags.username } for username"
17
+ puts "User has input:#{ Example.flags.password } for password"
18
+
19
+ # Try the following inputs
20
+ # ruby example_1.rb
21
+ #h# ruby example_1.rb -log logdirectory -dir directory -username me -password fluffy
@@ -1,21 +1,21 @@
1
1
  require 'optiflag'
2
2
 
3
- # Example 1.2:
4
- # Variation 2: Changing the universal short-form default symbol from '-' to '/'
5
- module Example extend OptiFlag::Flagset(:flag_symbol => "/")
3
+ # Title: Changing the universal short-form symbol
4
+ # Description: Everything is still the same, except we are now changing the default symbol from '-' to '/'
5
+ module Example extend OptiFlagSet(:flag_symbol => "/")
6
6
  flag "dir"
7
7
  flag "log"
8
8
  flag "username"
9
9
  flag "password"
10
10
 
11
- handle_errors_and_help
11
+ and_process!
12
12
  end
13
13
 
14
14
  # Some code to _use_ the values
15
- puts "User has input:#{ ARGV.flag_value.dir } for dir"
16
- puts "User has input:#{ ARGV.flag_value.log } for log"
17
- puts "User has input:#{ ARGV.flag_value.username } for username"
18
- puts "User has input:#{ ARGV.flag_value.password } for password"
15
+ puts "User has input:#{ ARGV.flags.dir } for dir"
16
+ puts "User has input:#{ ARGV.flags.log } for log"
17
+ puts "User has input:#{ ARGV.flags.username } for username"
18
+ puts "User has input:#{ ARGV.flags.password } for password"
19
19
 
20
20
 
21
21
  # Try the following inputs
@@ -0,0 +1,31 @@
1
+ require 'optiflag'
2
+ $log = "c:/log"
3
+
4
+ # Title: Adding an optional flag and a usage flag.
5
+ # Description: The optional flag allows us to declare that the flag is not required. Even though the help flag comes automatically with 'and_process!' we can add more synonymns for the default '-h' and '-?'. Also, we show how to use the flag with a ? method.
6
+ module Example extend OptiFlagSet
7
+ flag "dir"
8
+ optional_flag "log"
9
+ flag "username"
10
+ flag "password"
11
+ usage_flag "ayudame","help"
12
+
13
+ and_process!
14
+ end
15
+
16
+ if ARGV.flags.log? # note the question mark '?'
17
+ # this way we know whether or not the flag was
18
+ # set by the user or not
19
+ $log = ARGV.flags.log
20
+ puts "User input: #{ $log } for log via the command-line"
21
+ else
22
+ puts "User did NOT input log via the command-line"
23
+ end
24
+
25
+ #h# ruby example_2.rb --dir directory --username me --password fluffy
26
+ #h# ruby example_2.rb --dir directory --username me --password fluffy --log c:/tmp/log
27
+ # ruby example_2.rb -dir directory -username me -password fluffy -log c:/tmp/log
28
+ #h# ruby example_2.rb -ayudame
29
+ #h# ruby example_2.rb -?
30
+ # ruby example_2.rb -help
31
+
@@ -1,8 +1,8 @@
1
1
  require 'optiflag'
2
2
 
3
- # Example 2.1:
4
- # Variation 1: Using an extended usage flag
5
- module Example extend OptiFlag::Flagset
3
+ # Title: Using an extended usage flag
4
+ # Description: The extended usage flag allows us to ask for detailed information about our declared flags.
5
+ module Example extend OptiFlagSet
6
6
  flag "dir"
7
7
  optional_flag "log"
8
8
  flag "username"
@@ -10,7 +10,7 @@ module Example extend OptiFlag::Flagset
10
10
  usage_flag "h","help","?"
11
11
  extended_help_flag "superhelp"
12
12
 
13
- handle_errors_and_help
13
+ and_process!
14
14
  end
15
15
 
16
16
  #h# ruby example_2_1.rb -superhelp --dir directory --username me --password fluffy
@@ -1,23 +1,25 @@
1
1
  require 'optiflag'
2
2
 
3
- # Example 2.2:
4
- # Variation 2: Adding descriptions to the flags (will appear in extended help)
3
+ # Title: Adding 'description' as our first clause-level modifier.
4
+ # Description: Adding descriptions to the flags so that they will appear in extended help
5
5
  ### NOTE how 'description' can be nested in a block or used as a symbol key
6
- module Example extend OptiFlag::Flagset
6
+ module Example extend OptiFlagSet
7
7
  flag "dir" do
8
8
  description "The Appliction Directory"
9
9
  end
10
10
  optional_flag "log" do
11
11
  description "The directory in which to find the log files"
12
12
  end
13
- flag "username", :description => "Database username." # alternate form
13
+ # alternate form of description can be provided
14
+ # as a hash (to preserve vertical space)
15
+ flag "username", :description => "Database username."
14
16
  flag "password" do
15
17
  description "Database password."
16
18
  end
17
19
  usage_flag "h","help","?"
18
20
  extended_help_flag "superhelp"
19
21
 
20
- handle_errors_and_help
22
+ and_process!
21
23
  end
22
24
 
23
25
  ## Works (triggers extended help):
@@ -1,8 +1,8 @@
1
1
  require 'optiflag'
2
2
 
3
- # Example 2.3:
4
- # Variation 3: Adding alternate forms and long forms
5
- module Example extend OptiFlag::Flagset
3
+ # Title: Adding alternate forms and long forms
4
+ # Description: Alternate forms may be used in place of the regular flag. Long forms are used with the long form dispatch symbol (usually '--')
5
+ module Example extend OptiFlagSet
6
6
  flag "dir" do
7
7
  alternate_forms "directory","D","d"
8
8
  description "The Appliction Directory"
@@ -18,15 +18,15 @@ module Example extend OptiFlag::Flagset
18
18
  usage_flag "h","help","?"
19
19
  extended_help_flag "superhelp"
20
20
 
21
- handle_errors_and_help
21
+ and_process!
22
22
  end
23
23
 
24
24
  # Some code to _use_ the values
25
- puts "User has input: #{ ARGV.flag_value.dir } for dir"
26
- puts "User has input: #{ ARGV.flag_value.username } for username"
27
- puts "User has input: #{ ARGV.flag_value.password } for password"
28
- if ARGV.flag_value.log?
29
- puts "User has input: #{ARGV.flag_value.log } for log"
25
+ puts "User has input: #{ ARGV.flags.dir } for dir"
26
+ puts "User has input: #{ ARGV.flags.username } for username"
27
+ puts "User has input: #{ ARGV.flags.password } for password"
28
+ if ARGV.flags.log?
29
+ puts "User has input: #{ARGV.flags.log } for log"
30
30
  end
31
31
 
32
32
  # Try the following inputs
@@ -1,8 +1,8 @@
1
1
  require 'optiflag'
2
2
 
3
- # Example 2_4:
3
+ # Title: Other clause-level modifiers, like arity and flag symbol
4
4
  # Variation 4: Selectively changing the symbol for a flag, and change the arity to be no-args
5
- module Example extend OptiFlag::Flagset
5
+ module Example extend OptiFlagSet
6
6
  flag "dir" do
7
7
  alternate_forms "directory","D","d"
8
8
  description "The Appliction Directory"
@@ -24,10 +24,10 @@ module Example extend OptiFlag::Flagset
24
24
  usage_flag "h","help","?"
25
25
  extended_help_flag "superhelp"
26
26
 
27
- handle_errors_and_help
27
+ and_process!
28
28
  end
29
29
 
30
- if ARGV.flag_value.delete?
30
+ if ARGV.flags.delete?
31
31
  # super dangerous code to delete the database....
32
32
  puts "Special DELETE flag invoked with special flag-symbol"
33
33
  end
@@ -1,8 +1,8 @@
1
1
  require 'optiflag'
2
2
 
3
- # Example 2.5:
4
- # Variation 5: User can get help on a specific flag.
5
- module Example extend OptiFlag::Flagset
3
+ # Title: Help flag can be used for a specific flag.
4
+ # Description: The normal help flag can be used with a parameter so that you can get more information on any of the particular flags.
5
+ module Example extend OptiFlagSet
6
6
  flag "dir"
7
7
  optional_flag "log" do
8
8
  description "The directory into which log files will be written"
@@ -15,7 +15,7 @@ module Example extend OptiFlag::Flagset
15
15
  end
16
16
  usage_flag "h","help","?"
17
17
 
18
- handle_errors_and_help
18
+ and_process!
19
19
  end
20
20
 
21
21
  ## Normal mode: