@@ -47,15 +47,19 @@ my %CMDLINE_OPTS = (
47
47
# INCLUDE => ['i','|include=s@'],
48
48
# KEEP_GOING => ['k','|keep-going',false], #not in gawk
49
49
# LIB => ['l','|load=s@'],
50
- # LINT => ['L','|lint :s'],
50
+ LANGUAGE => [' L' ,' |language :s' ],
51
51
# --man reserved
52
52
# OUTPUT_FILENAME => ['o','|output=s', ""], # conflict with gawk
53
+ # OPTIMIZE => ['O','|optimize'],
53
54
# SANDBOX => ['S','|sandbox',false],
54
55
# SOURCES reserved
55
56
# --usage reserved
56
- PRINT_VERSION => [' V ' ,' |version ' , false],
57
+ PRINT_VERSION => [' version ' ,' ' , false],
57
58
DEFS => [' v' ,' |var:s%' ],
58
59
# -? reserved
60
+ #
61
+ # gawk(1) long options: --dump-variables, --exec, --gen-po, --lint,
62
+ # --profile
59
63
60
64
# Long-only options that are specific to axk.
61
65
NO_INPUT => [' no-input' ], # When set, don't read any files. This is so
@@ -131,6 +135,11 @@ sub Main {
131
135
my %opts ;
132
136
parse_command_line(from => $lrArgs , into => \%opts );
133
137
138
+ if ($opts {PRINT_VERSION }) {
139
+ say " axk $VERSION " ;
140
+ return 0;
141
+ }
142
+
134
143
# Treat the first non-option arg as a script if appropriate
135
144
unless (@{$opts {SOURCES }}) {
136
145
croak " No scripts to run" unless @$lrArgs ;
@@ -149,7 +158,7 @@ sub Main {
149
158
} else {
150
159
$core -> load_script_text($text ,
151
160
" (cmd line script #@{[++$cmd_line_idx ]})" ,
152
- true); # true => add a Vn if there isn't one in the script
161
+ true); # true => add a Ln if there isn't one in the script
153
162
}
154
163
} # foreach source
155
164
@@ -185,19 +194,59 @@ Version 0.1.0
185
194
186
195
axk [options] [--] [script] [input filename(s)]
187
196
188
- =head1 OPTIONS
197
+ =head1 INPUTS
189
198
190
199
A filename of C<- > represents standard input. To actually process a file
191
200
named C<- > , you will need to use shell redirection (e.g., C<< axk < - >>).
192
201
Standard input is the default if no input filenames are given.
193
202
194
203
The first non-option argument is a program if no -e or -f are given.
195
204
The script language version for a -e will default to the latest if the text
196
- on the command line doesn't match C</^\s*V\s*\d+[\s;]+/ > .
205
+ on the command line doesn't specify a language version.
206
+
207
+ =head1 OPTIONS
208
+
209
+ =over
210
+
211
+ =item -e, --source B<text >
212
+
213
+ Run the axk code given as B<text > .
214
+
215
+ =item -f, --file B<filename >
216
+
217
+ Run the axk code given in the file called B<filename > .
218
+
219
+ =item -L, --language B<language >
220
+
221
+ B<Not yet implemented: >
222
+ Interpret the following B<-e > in axk language B<language > .
223
+
224
+ =item --show B<what >
225
+
226
+ Show debugging information. Currently implemented are:
227
+
228
+ =over
229
+
230
+ =item source
231
+
232
+ Show the Perl source generated from the provided axk code.
233
+
234
+ =back
235
+
236
+ =item -v, --var B<name > =B<value >
237
+
238
+ B<Not yet implemented: >
239
+ Set B<name > =B<value > .
240
+
241
+ =item --version
242
+
243
+ Print the version of axk and exit
244
+
245
+ =back
197
246
198
247
=head1 AUTHOR
199
248
200
- Christopher White, C<< < cxwembedded at gmail.com> > >
249
+ Christopher White, C<cxwembedded at gmail.com >
201
250
202
251
=head1 BUGS
203
252
0 commit comments