3 docSlot("launchScript", "Returns the path of the io file run on the command line. Returns nil if no file was run.")
5 ioPath
:= installPrefix asMutable
appendPathSeq("lib") appendPathSeq("io")
6 docSlot("ioPath", "Returns the path of io installation. The default is $INSTALL_PREFIX/lib/io.")
8 docSlot("getOptions(args)", "
9 This primitive is used to get command line options similar to Cs getopt().
10 It returns a map in containing the left side of the argument, with the
11 value of the right side. (The key will not contain
12 the beginning dashes (--).
16 options := System getOptions(args)
18 if(v type == List type,
19 v foreach(i, j, writeln(\"Got unnamed argument with value: \" .. j))
22 writeln(\"Got option: \" .. k .. \" with value: \" .. v)
27 getOptions
:= method(arguments
,
29 optname
:= Sequence
clone
30 optvalue
:= Sequence
clone
31 optsNoKey
:= List clone
33 arguments
foreach(i
, arg
,
34 if(arg
beginsWithSeq("--") isNil,
39 if(arg
containsSeq("=")) then(
40 optname
:= arg
clone asMutable
41 optname
clipAfterStartOfSeq("=")
42 optname
clipBeforeEndOfSeq("--")
43 optvalue
:= arg
clone asMutable
44 optvalue
clipBeforeEndOfSeq("=")
46 optname
:= arg
clone asMutable
47 optname
clipBeforeEndOfSeq("--")
50 opts
atPut(optname
, optvalue
)
53 if(optsNoKey last
!= nil
, opts
atPut("", optsNoKey
))