Skip to content

Commit 8b0fa34

Browse files
committed
First part of new MAIN features refs #2632: Enumeration
1 parent eaefb74 commit 8b0fa34

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

doc/Language/create-cli.pod6

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,28 @@ Usage:
196196
--verbose required verbosity
197197
=end code
198198
199+
C<Enumeration>s can be used in signatures with arguments converted
200+
automatically to its corresponding C<enum> symbol:
201+
202+
=begin code
203+
enum Flags (
204+
FLAG_FOO => 0b001,
205+
FLAG_BAR => 0b010,
206+
FLAG_BAZ => 0b100,
207+
);
208+
209+
sub MAIN( Enumeration $flag = FLAG_FOO) {
210+
say "Flagging $flag";
211+
}
212+
=end code
213+
214+
This will work correctly with
215+
216+
=for code :lang<text>
217+
raku MAIN-enum.p6 FLAG_BAR
218+
219+
but will die if called with something that is not an enum.
220+
199221
X<|%*SUB-MAIN-OPTS>
200222
=head2 %*SUB-MAIN-OPTS
201223

0 commit comments

Comments
 (0)