Skip to content

Commit

Permalink
rename wasi-cli-base to wasi-cli, delete preview package, import wa…
Browse files Browse the repository at this point in the history
…si-cli

wasi-cli import is sum of
WebAssembly/wasi-cli#19 and
WebAssembly/wasi-cli#20
  • Loading branch information
Pat Hickey committed Aug 4, 2023
1 parent d7f1a78 commit 3c4463c
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 88 deletions.
36 changes: 0 additions & 36 deletions crates/wasi/wit/deps/preview/command-extended.wit

This file was deleted.

9 changes: 0 additions & 9 deletions crates/wasi/wit/deps/preview/proxy.wit

This file was deleted.

24 changes: 0 additions & 24 deletions crates/wasi/wit/deps/preview/reactor.wit

This file was deleted.

4 changes: 0 additions & 4 deletions crates/wasi/wit/deps/wasi-cli-base/exit.wit

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package wasi:cli

world command {
import wasi:clocks/wall-clock
import wasi:clocks/monotonic-clock
Expand All @@ -16,11 +18,15 @@ world command {
import wasi:random/insecure-seed
import wasi:poll/poll
import wasi:io/streams
import wasi:cli-base/environment
import wasi:cli-base/exit
import wasi:cli-base/stdin
import wasi:cli-base/stdout
import wasi:cli-base/stderr

export run: func() -> result
import environment
import exit
import stdin
import stdout
import stderr
import terminal-input
import terminal-output
import terminal-stdin
import terminal-stdout
import terminal-stderr
export run
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package wasi:cli-base

interface environment {
/// Get the POSIX-style environment variables.
///
Expand All @@ -13,4 +11,8 @@ interface environment {

/// Get the POSIX-style arguments to the program.
get-arguments: func() -> list<string>

/// Return a path that programs should use as their initial current working
/// directory, interpreting `.` as shorthand for this.
initial-cwd: func() -> option<string>
}
4 changes: 4 additions & 0 deletions crates/wasi/wit/deps/wasi-cli/exit.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface exit {
/// Exit the current instance and any linked instances.
exit: func(status: result)
}
4 changes: 4 additions & 0 deletions crates/wasi/wit/deps/wasi-cli/run.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface run {
/// Run the program.
run: func() -> result
}
File renamed without changes.
59 changes: 59 additions & 0 deletions crates/wasi/wit/deps/wasi-cli/terminal.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
interface terminal-input {
/// The input side of a terminal.
///
/// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
type terminal-input = u32

// 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.

/// Dispose of the specified terminal-input after which it may no longer
/// be used.
drop-terminal-input: func(this: terminal-input)
}

interface terminal-output {
/// The output side of a terminal.
///
/// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
type terminal-output = u32

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

/// Dispose of the specified terminal-output, after which it may no longer
/// be used.
drop-terminal-output: func(this: terminal-output)
}

/// An interface providing an optional `terminal-input` for stdin as a
/// link-time authority.
interface terminal-stdin {
use terminal-input.{terminal-input}

/// If stdin is connected to a terminal, return a `terminal-input` handle
/// allowing further interaction with it.
get-terminal-stdin: func() -> option<terminal-input>
}

/// An interface providing an optional `terminal-output` for stdout as a
/// link-time authority.
interface terminal-stdout {
use terminal-output.{terminal-output}

/// If stdout is connected to a terminal, return a `terminal-output` handle
/// allowing further interaction with it.
get-terminal-stdout: func() -> option<terminal-output>
}

/// An interface providing an optional `terminal-output` for stderr as a
/// link-time authority.
interface terminal-stderr {
use terminal-output.{terminal-output}

/// If stderr is connected to a terminal, return a `terminal-output` handle
/// allowing further interaction with it.
get-terminal-stderr: func() -> option<terminal-output>
}
12 changes: 6 additions & 6 deletions crates/wasi/wit/test.wit
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// only used as part of `test-programs`
world test-reactor {

import wasi:cli-base/environment
import wasi:cli/environment
import wasi:io/streams
import wasi:filesystem/types
import wasi:filesystem/preopens
import wasi:cli-base/exit
import wasi:cli/exit

export add-strings: func(s: list<string>) -> u32
export get-strings: func() -> list<string>
Expand All @@ -21,8 +21,8 @@ world test-reactor {
world test-command {
import wasi:poll/poll
import wasi:io/streams
import wasi:cli-base/environment
import wasi:cli-base/stdin
import wasi:cli-base/stdout
import wasi:cli-base/stderr
import wasi:cli/environment
import wasi:cli/stdin
import wasi:cli/stdout
import wasi:cli/stderr
}

0 comments on commit 3c4463c

Please sign in to comment.