API Reference › Os › Os.args
method

Os.args

Os.args() -> []string

Returns the whole argument vector as a []string: element 0 is the program path, and the rest are the arguments the process was launched with. The list has exactly arg_count() elements, so you can iterate it directly to parse launch flags.

Example

program Args {
  entry {
    let all = Os.args()
    var i = 0
    while i < len(all) { print(len(all[i])); i = i + 1 }   # one length per argument
  }
}
← All symbols