Fix -s and add --help and -h

This commit is contained in:
Rampoina 2023-03-05 21:43:12 +01:00
parent 3e620d5f0b
commit 4919a9903a
1 changed files with 11 additions and 2 deletions

13
arc.bqn
View File

@ -7,11 +7,20 @@
opts{
a•args
chars {0=𝕩?" λ$⊕⭍#/\-|+<>^v";𝕩}(»(<"--chars"))/a
{𝕤
•Out "Usage: "•name" [OPTION]...
--help: 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"
•Exit 0
}(("-h"<a)"--help"<a) @
chars{0=𝕩?" λ$⊕⭍#/\-|+<>^v";𝕩}(»(<"--chars"))/a
fchars{0=𝕩?" λ$⊕⭍#/\-|+<>^v";𝕩}(»(<"--fchars"))/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
n{0=𝕩?1;1𝕩}•BQN¨{𝕊: •Out "Invalid starting level number" •Exit 1}(»(<"-s"))/a
}
gGame{𝕊: •Out •CurrentError @ •Exit 1} opts.nopts.levelsopts.charsopts.fcharsansi.defaultB,ansi.yellow,ansi.cyan,ansi.red