wall initial implementation - #578
Conversation
|
nice |
…test into the library
…test into the library
|
a few jobs are failing |
|
Yes sorry I updated the pr by error, I still need to work on this |
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Introduces an initial implementation of the wall utility as a new optional workspace crate, along with basic CLI parsing and a small set of utility-specific tests.
Changes:
- Adds new
uu_wallcrate (library + binary) and wires it into workspace features/dependencies - Implements Unix-only
walllogic: message sourcing (stdin/args/file), scanning logged-in users viautmpx, and writing to ttys - Adds initial tests and minor formatting/import cleanups in existing test files
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/tests.rs | Registers the wall test module behind the wall feature flag |
| tests/by-util/test_wall.rs | Adds initial cross-platform tests for wall behavior |
| tests/by-util/test_setsid.rs | Adjusts import ordering (no functional change) |
| tests/by-util/test_lslocks.rs | Reflows an array literal for formatting (no functional change) |
| src/uu/wall/wall.md | Adds minimal help/about text for wall |
| src/uu/wall/src/wall.rs | Implements the core wall command logic and CLI definition |
| src/uu/wall/src/main.rs | Adds binary entrypoint using uucore::bin! |
| src/uu/wall/Cargo.toml | Adds new crate manifest and dependencies for uu_wall |
| Cargo.toml | Enables wall as an optional workspace feature/dependency |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| let matches = uucore::clap_localization::handle_clap_result(uu_app(), args) | ||
| .map_err(|e| USimpleError::new(1, e.to_string()))?; // Clap would have return 101 | ||
| // Might be considered wrong for --help and --version |
|
|
||
| let user = env::var_os(user).unwrap_or_default(); | ||
| // Fetch the TTY of the process calling wall (requires OS-specific calls or a wrapper function) | ||
| let tty = &get_sender(); |
| #[error("wall: cannot read stdin")] | ||
| Stdin(#[from] io::Error), |
| fn read_from_file(file: &OsString) -> Result<String, WallError> { | ||
| let mut buffer = Vec::new(); | ||
| let mut file = std::fs::File::open(file)?; |
| let datetime = get_hour_and_date(); | ||
| #[cfg(target_os = "macos")] | ||
| return format!( | ||
| "\r\nBroadcast message from {}@{} ({tty}) at ({datetime} \r\n\r\n", |
| .long(OPT_NOBANNER) | ||
| .required(false) | ||
| .action(ArgAction::SetTrue) | ||
| .help("Suppress the intro branner of the broadcast"), |
| [dependencies] | ||
| chrono = { workspace = true } | ||
| clap.workspace = true | ||
| nix = { workspace = true, features = ["feature", "fs", "hostname", "term"] } |
| #[cfg(target_os = "linux")] | ||
| #[test] | ||
| fn test_invalid_file() { | ||
| new_ucmd!().arg("not_existing_file.not_existing_extension"); // Should print non-file name as broadcast |
This pull request introduces an implementation of the 'wall' utility. It aims to be a first-draft binary crate since the flags of the wall command are not implemented yet.
New utility implementation:
CLI and mechanics: