Skip to content

Commit 9df0f82

Browse files
authored
make alias example about single-letter variants for long-form args
This should be the most interesting use case for parameter aliases in the CLI context.
1 parent da12180 commit 9df0f82

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

doc/Language/create-cli.rakudoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,13 @@ And here's the signature that produces each type of argument:
268268

269269
As any other subroutine, C<MAIN> can define
270270
L<aliases|/language/signatures#Argument_aliases> for its named parameters.
271+
In particular, this can be used to define single-letter alternative names.
271272

272273
=for code :method<False>
273274
sub MAIN(
274275
Str $file where *.IO.f = 'file.dat', #= an existing file to frobnicate
275-
Int :size(:$length) = 24, #= length/size needed for frobnication
276-
Bool :$verbose, #= required verbosity
276+
Int :l(:$length) = 24, #= length needed for frobnication
277+
Bool :v(:$verbose), #= required verbosity
277278
) {
278279
say $length if $length.defined;
279280
say $file if $file.defined;
@@ -287,8 +288,8 @@ Usage:
287288
frobnicate.raku [--size|--length=<Int>] [--verbose] [<file>]
288289

289290
[<file>] an existing file to frobnicate
290-
--size|--length=<Int> length needed for frobnication
291-
--verbose required verbosity
291+
-l|--length=<Int> length needed for frobnication
292+
-v|--verbose required verbosity
292293
=end code
293294

294295
=head2 Named arrays

0 commit comments

Comments
 (0)