componentized/directory

wasi:cli

interface dependency

A WASI API for Command-Line Interface environments.

interface environment wasi:cli/environment@0.2.3 since 0.2.0

Functions

functionget-environment: func() -> list<tuple<string, string>>since 0.2.0

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.

functionget-arguments: func() -> list<string>since 0.2.0

Get the POSIX-style arguments to the program.

functioninitial-cwd: func() -> option<string>since 0.2.0

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

WIT

@since(version = 0.2.0)
interface environment {
  /// 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.
  @since(version = 0.2.0)
  get-environment: func() -> list<tuple<string, string>>;

  /// Get the POSIX-style arguments to the program.
  @since(version = 0.2.0)
  get-arguments: func() -> list<string>;

  /// Return a path that programs should use as their initial current working
  /// directory, interpreting `.` as shorthand for this.
  @since(version = 0.2.0)
  initial-cwd: func() -> option<string>;
}