Handbook
Glossary
parse-optional ( options command-line -- command-line' )
Vocabulary
command-line
.
parser
.
private
Inputs
options
an
object
command-line
an
object
Outputs
command-line'
an
object
Definition
USING:
kernel
namespaces
sequences
splitting
;
IN:
command-line.parser.private
::
parse-optional
( options command-line -- command-line' )
command-line
unclip
:>
( args arg ) arg
[
45
=
]
trim-head
"="
split1
:>
( name value ) name options
split-negation
:>
( positive-name negated? ) positive-name options
find-option
:>
option value
[
negated? option
option-#args
{
f
0
}
member?
or
[
option value
invalid-value
]
when
]
when
args value
[
prefix
]
when*
negated?
[
f
]
[
option
option-value
]
if
option
option-variable
set
;