-
Notifications
You must be signed in to change notification settings - Fork 923
CLI: Code cleanup and small progressbar improvements #5825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
64079c3 to
9535733
Compare
|
The progress bar is really neat, I like it! For the future, we might want to integrate detailed bar update for |
9535733 to
2619307
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the CLI code to replace the external is-terminal crate with the standard library's IsTerminal trait, and reorganizes the wasmer run command implementation by extracting code into separate modules.
- Replaces
is-terminalcrate dependency withstd::io::IsTerminalfrom the standard library - Extracts
PackageSource,ExecutableTarget, andMonitoringRuntimefromrun/mod.rsinto separate module files (package_source.rs,target.rs,runtime.rs) - Adds a new helper method
is_quiet_or_no_tty()to theOutputstruct for better encapsulation of quiet mode logic - Renames internal
PackageSourceenum toCliPackageSourceto avoid naming conflict withwasmer_config::package::PackageSource
Reviewed Changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/cli/Cargo.toml | Removed is-terminal dependency from CLI package |
| lib/cli-compiler/Cargo.toml | Removed is-terminal dependency from CLI compiler package |
| Cargo.lock | Removed is-terminal from dependency tree |
| lib/cli/src/logging.rs | Replaced is-terminal::IsTerminal with std::io::IsTerminal, added is_quiet_or_no_tty() helper method |
| lib/cli/src/commands/run/mod.rs | Refactored to use new modules, updated references from PackageSource to CliPackageSource, updated to use is_quiet_or_no_tty() |
| lib/cli/src/commands/run/package_source.rs | New module containing CliPackageSource enum (extracted from mod.rs) |
| lib/cli/src/commands/run/target.rs | New module containing ExecutableTarget and TargetOnDisk enums (extracted from mod.rs) |
| lib/cli/src/commands/run/runtime.rs | New module containing MonitoringRuntime and related structs (extracted from mod.rs) |
| lib/cli/src/commands/run/wasi.rs | Updated import to use CliPackageSource |
| lib/cli/src/commands/run/capabilities/*.rs | Updated references from PackageSource to CliPackageSource |
| lib/cli/src/commands/package/*.rs | Replaced is-terminal::IsTerminal with std::io::IsTerminal |
| lib/cli/src/commands/app/**/*.rs | Replaced is-terminal::IsTerminal with std::io::IsTerminal |
| lib/cli/src/commands/auth/logout.rs | Replaced is-terminal::IsTerminal with std::io::IsTerminal |
| lib/cli/src/commands/mod.rs | Replaced is-terminal::IsTerminal usage with std library version |
| lib/cli-compiler/src/utils.rs | Replaced is-terminal::IsTerminal with std::io::IsTerminal |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| /// Special wasix runtime implementation for the CLI. | ||
| /// | ||
| /// Wraps an undelrying runtime and adds progress monitoring for package |
Copilot
AI
Oct 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'undelrying' to 'underlying'.
| /// Wraps an undelrying runtime and adds progress monitoring for package | |
| /// Wraps an underlying runtime and adds progress monitoring for package |
The mod.rs is long and contains a lot of things. This commit: * splits funcitonality out into submodules (targetrs, runtime.rs, package_source.rs) * Renames the shadowing PackageSource to CliPackageSource to avoid the renamed import and name confusion * Fixes some other small code quality issues (eg Self vs <name> in impls)
* Use a single progress bar * Show bar again if it was hidden * Remove code duplication for quiet flag handling
The functionality from the is-terminal crate was lifted into the standard library. Since we recently bumped the Rust MSRV, we can now rely on it and remove a dependency.
2619307 to
a98b740
Compare
Cleans up the CLI
runcommand code a bit by splitting up code into submodules,improving code flow for the progress bar, and replacing the
is-terminalcratewith standard library functionality.
Best reviewed commit by commit.
Dropped:
chore(cli): Only show compilation progress bar after a delay
Because it doesn't work correctly.