mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
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:
11
test/process/all_arguments.wren
Normal file
11
test/process/all_arguments.wren
Normal 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.
|
||||
6
test/process/arguments.wren
Normal file
6
test/process/arguments.wren
Normal 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.
|
||||
Reference in New Issue
Block a user