cli

Version:
sha256:e7e8545
wit

environment interface

get-environment()list<tuple<string, string>>

Get the POSIX-style environment variables.

Each environment variable is provided as a pair of string variable names and string value.

Morally, these are a value import, but until value imports are available in the component model, this import function should return the same values each time it is called.

get-arguments()list<string>

Get the POSIX-style arguments to the program.

initial-cwd()option<string>

Return a path that programs should use as their initial current working directory, interpreting . as shorthand for this.

exit interface

exit(status:result<_, _>)

Exit the current instance and any linked instances.

run interface

run()result<_, _>

Run the program.

stdin interface

Imported Types
wasi:io/streams.{input-stream}
get-stdin()input-stream

stdout interface

Imported Types
wasi:io/streams.{output-stream}
get-stdout()output-stream

stderr interface

Imported Types
wasi:io/streams.{output-stream}
get-stderr()output-stream

terminal-input interface

Terminal input.

In the future, this may include functions for disabling echoing, disabling input buffering so that keyboard events are sent through immediately, querying supported features, and so on.

terminal-input:resource {

The input side of a terminal.

}

terminal-output interface

Terminal output.

In the future, this may include functions for querying the terminal size, being notified of terminal size changes, querying supported features, and so on.

terminal-output:resource {

The output side of a terminal.

}

terminal-stdin interface

An interface providing an optional terminal-input for stdin as a link-time authority.

Imported Types
wasi:cli/terminal-input.{terminal-input}
get-terminal-stdin()option<terminal-input>

If stdin is connected to a terminal, return a terminal-input handle allowing further interaction with it.

terminal-stdout interface

An interface providing an optional terminal-output for stdout as a link-time authority.

Imported Types
wasi:cli/terminal-output.{terminal-output}
get-terminal-stdout()option<terminal-output>

If stdout is connected to a terminal, return a terminal-output handle allowing further interaction with it.

terminal-stderr interface

An interface providing an optional terminal-output for stderr as a link-time authority.

Imported Types
wasi:cli/terminal-output.{terminal-output}
get-terminal-stderr()option<terminal-output>

If stderr is connected to a terminal, return a terminal-output handle allowing further interaction with it.