Handbook
Glossary
parse-arguments ( options command-line -- arguments )
Vocabulary
command-line
.
parser
.
private
Inputs
options
an
object
command-line
an
object
Outputs
arguments
an
object
Definition
USING:
accessors
assocs
kernel
namespaces
sequences
splitting
;
IN:
command-line.parser.private
:
parse-arguments
( options command-line -- arguments )
[
dup
[
optional?
]
partition
]
dip
{
"--"
}
split1
[
(parse-arguments)
f
swap
]
dip
(parse-arguments)
[
#args>>
{
"*"
"?"
}
member?
]
reject
[
required-options
]
unless-empty
[
required?>>
]
filter
namespace
[
[
[
option-variable
]
]
dip
[
key?
]
curry
compose
reject
[
required-options
]
unless-empty
]
keep
;