Add API for accessing command-line arguments.

- Add process module with Process class.
- Add "arguments" and "allArguments" methods.
- Docs for same.
- Support passing additional arguments to command line.
- Add "--help" support to command line.
This commit is contained in:
Bob Nystrom
2016-01-22 07:57:26 -08:00
parent 860220869a
commit 71e2458a6c
14 changed files with 211 additions and 4 deletions

View File

@ -0,0 +1,11 @@
import "process" for Process
var args = Process.allArguments
System.print(args is List) // expect: true
System.print(args.count) // expect: 2
// Includes wren executable and file being run.
System.print(args[0].endsWith("wrend")) // expect: true
System.print(args[1]) // expect: test/process/all_arguments.wren
// TODO: Test passing additional args once we have an API to spawn a process.

View File

@ -0,0 +1,6 @@
import "process" for Process
// No additional arguments are passed to the test.
System.print(Process.arguments) // expect: []
// TODO: Test passing additional args once we have an API to spawn a process.