mirror of
https://github.com/uutils/shadow.git
synced 2026-06-10 16:14:57 -07:00
arch: migrate to uucore for true uutils drop-in compatibility
Fixes #8 - Added uucore 0.7 as workspace dependency - main.rs now uses uucore::bin!(uu_passwd) one-liner (SIGPIPE, localization, signal handling all handled by uucore) - uumain decorated with #[uucore::main], returns UResult<()> - Created PasswdError enum implementing UError trait with correct exit code mapping (1=permission, 2=options, 3=failure, 4=missing, 5=busy, 6=invalid, 10=PAM) - Internal helpers return Result<T, PasswdError> instead of raw i32 - Informational messages use uucore::show_error! macro (auto-prefixes with utility name) - Error propagation via ? operator instead of early return with codes The tool now follows the exact uucore API contract: pub fn uumain(args: impl uucore::Args) -> UResult<()> pub fn uu_app() -> Command 95 tests passing on Debian/Alpine/Fedora, zero clippy warnings.
This commit is contained in:
@@ -31,6 +31,9 @@ shadow-core = { path = "src/shadow-core" }
|
||||
# CLI
|
||||
clap = { version = "4", features = ["derive", "wrap_help"] }
|
||||
|
||||
# uutils integration
|
||||
uucore = "0.7"
|
||||
|
||||
# Error handling
|
||||
thiserror = "2"
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ libc = { workspace = true }
|
||||
nix = { workspace = true }
|
||||
shadow-core = { workspace = true, features = ["shadow", "login-defs"] }
|
||||
thiserror = { workspace = true }
|
||||
uucore = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@@ -3,7 +3,4 @@
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
fn main() {
|
||||
let code = uu_passwd::uumain(std::env::args_os());
|
||||
std::process::exit(code);
|
||||
}
|
||||
uucore::bin!(uu_passwd);
|
||||
|
||||
+189
-124
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user