Add short options
This commit is contained in:
parent
f327bd29be
commit
276d6cd6ca
17
arc.bqn
17
arc.bqn
|
@ -9,18 +9,23 @@ opts←{
|
|||
a←•args
|
||||
{𝕤
|
||||
•Out "Usage: "∾•name∾" [OPTION]...
|
||||
--help: Display this help message
|
||||
--help,-h: Display this help message
|
||||
--levels,-l FILE: load levels from FILE
|
||||
--chars STRING: Characters to display for each game object, needs to have length 15
|
||||
--fchars STRING: Characters to represent each game object in the levels file, needs to have length 15"
|
||||
--chars,-c STRING: Characters to display for each game object, needs to have length 15
|
||||
--fchars,-f STRING: Characters to represent each game object in the levels file, needs to have length 15
|
||||
--start,-s N: Start directly at level number N
|
||||
"
|
||||
•Exit 0
|
||||
}⍟((∨´"-h"<⊸⍷a)∨(∨´"--help"<⊸⍷a)) @
|
||||
|
||||
chars⇐{0=≠𝕩?" λ$⊕⭍#/\-|+<>^v";⊑𝕩}(»(<"--chars")⊸⍷)⊸/a
|
||||
fchars⇐{0=≠𝕩?" λ$⊕⭍#/\-|+<>^v";⊑𝕩}(»(<"--fchars")⊸⍷)⊸/a
|
||||
c⇐{0=≠𝕩?" λ$⊕⭍#/\-|+<>^v";⊑𝕩}(»(<"--chars")⊸⍷)⊸/a
|
||||
f⇐{0=≠𝕩?" λ$⊕⭍#/\-|+<>^v";⊑𝕩}(»(<"--fchars")⊸⍷)⊸/a
|
||||
chars⇐{0=≠𝕩?c;⊑𝕩}(»(<"-c")⊸⍷)⊸/a
|
||||
fchars⇐{0=≠𝕩?f;⊑𝕩}(»(<"-f")⊸⍷)⊸/a
|
||||
l←{0=≠𝕩?"levels";⊑𝕩}(»(<"--levels")⊸⍷)⊸/a
|
||||
levels⇐{0=≠𝕩?l;⊑𝕩}(»(<"-l")⊸⍷)⊸/a
|
||||
n⇐{0=≠𝕩?1;1⌈⊑𝕩}•BQN¨⎊{𝕊: •Out "Invalid starting level number" ⋄ •Exit 1}(»(<"-s")⊸⍷)⊸/a
|
||||
s⇐{0=≠𝕩?1;1⌈⊑𝕩}•BQN¨⎊{𝕊: •Out "Invalid starting level number" ⋄ •Exit 1}(»(<"-s")⊸⍷)⊸/a
|
||||
n⇐{0=≠𝕩?s;1⌈⊑𝕩}•BQN¨⎊{𝕊: •Out "Invalid starting level number" ⋄ •Exit 1}(»(<"--start")⊸⍷)⊸/a
|
||||
}
|
||||
|
||||
g←Game⎊{𝕊: •Out •CurrentError @ ⋄ •Exit 1} opts.n‿opts.levels‿opts.chars‿opts.fchars‿⟨ansi.defaultB,ansi.yellow,ansi.cyan,ansi.red⟩
|
||||
|
|
Loading…
Reference in New Issue