Parse command-line arguments: Difference between revisions

added Arturo
m (→‎{{header|Raku}}: Undo bizarre single space indent that somebody found necessary to do)
(added Arturo)
Line 8:
Many languages provide a library (getopt or GetOpt) to parse the raw command line options in an intelligent way.
<br><br>
 
=={{header|Arturo}}==
 
<syntaxhighlight lang="arturo">loop.with:'i arg 'a ->
print ["argument" (to :string i)++":" a]
 
loop args [k,v]->
if k <> "values" ->
print ["found option:" k "with value:" v "(of type:" (to :string type v)++")"]</syntaxhighlight>
 
'''Sample input:'''
 
<pre>arturo parse\ command-line\ arguments.art one two --file:four --verbose --loop:3 three</pre>
 
'''Sample output:'''
 
<pre>argument 0: one
argument 1: two
argument 2: --file:four
argument 3: --verbose
argument 4: --loop:3
argument 5: three
found option: file with value: four (of type: string)
found option: verbose with value: true (of type: logical)
found option: loop with value: 3 (of type: integer)</pre>
 
=={{header|AutoHotkey}}==
1,532

edits