blob: 3085784cae24eaa47c3ea13147a40f857e4e09f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# Command-Line Arguments
Inferno has a dedicated module for processing commandline flags and arguments, arg(2).
## Source
### args.b:17,22
### args.b:24,37
Note: After the processing of all flags, `argv` is re-set from the value contained within `arg` to remove the elements (if any) utilized by flags and their arguments.
### args.b:41,51
## Demo
; limbo args.b
; args -h
usage: args [-r] [-c mark] words...
; args a b c d
Argc after flags: 4
→ a
→ b
→ c
→ d
; args -r a b c d
Argc after flags: 4
→ d
→ c
→ b
→ a
; args -c 'quack: ' a b c d
Argc after flags: 4
quack: a
quack: b
quack: c
quack: d
; args -r -c '-> ' d c b a
Argc after flags: 4
-> a
-> b
-> c
-> d
;
|