feat: add process module with arguments and allArguments static methods
- Introduce new 'process' module exposing a Process class with foreign static methods for accessing command-line arguments. - Implement processSetArguments in main.c to store argc/argv, and processAllArguments in process.c to return them as a Wren list. - Add --help flag support to CLI, printing usage with optional arguments. - Include documentation for Process.arguments and Process.allArguments, plus module index and template updates. - Register process module in modules.c and add Xcode project references for new source files. - Add test scripts for allArguments and arguments, verifying list type, count, and expected values.
This commit is contained in:
@@ -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.
|
||||
@@ -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