Command line
Get an argument
Section titled “Get an argument”Given a file named “main.scm” with:
(import (scheme base) (scheme process-context))
(map write-string (command-line))When I successfully run stak main.scm hello
Then the stdout should contain “hello”.
Get two arguments
Section titled “Get two arguments”Given a file named “main.scm” with:
(import (scheme base) (scheme process-context))
(map write-string (command-line))When I successfully run stak main.scm hello world
Then the stdout should contain “hello”
And the stdout should contain “world”.
Get an argument at an index
Section titled “Get an argument at an index”Given a file named “main.scm” with:
(import (scheme base) (scheme cxr) (scheme process-context))
(write-string (<procedure> (command-line)))When I successfully run stak main.scm foo bar baz
Then the stdout should contain “<output>”.
Examples
Section titled “Examples”| procedure | output |
|---|---|
| cadr | foo |
| caddr | bar |
| cadddr | baz |