You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The clap-error → exit-code handling with an AlreadyPrinted(i32) sentinel variant is copy-pasted into ~13 tool error enums: an identical Display arm returning Ok(()), an identical code() arm, and a near-identical try_get_matches_from error-kind match in each uumain. Only the codes differ (passwd: conflict→2, else→6; most others: conflict→2, else→1). See src/uu/passwd/src/passwd.rs:80-110 and :150-166, with the same shape in chage, chpasswd, chsh, usermod, groupdel, …
Otherwise add one helper + shared sentinel in src/shadow-core/src/cli.rs, e.g. from_clap_error(e, conflict_code, other_code), and call it from each uumain. Each tool keeps its own domain error enum but drops the AlreadyPrinted variant and its Display/code arms.
Do not collapse the per-tool domain error enums into USimpleError — their exit codes are GNU-specific and individually documented; only the clap/sentinel plumbing is shared.
For newcomers
Depends on the uucore bump (#179) - without it you'll be fighting the old 0.8 API. New to the codebase? Scope your PR to just passwd first; the other 12 tools can follow as separate PRs.
The clap-error → exit-code handling with an
AlreadyPrinted(i32)sentinel variant is copy-pasted into ~13 tool error enums: an identicalDisplayarm returningOk(()), an identicalcode()arm, and a near-identicaltry_get_matches_fromerror-kindmatchin eachuumain. Only the codes differ (passwd: conflict→2, else→6; most others: conflict→2, else→1). Seesrc/uu/passwd/src/passwd.rs:80-110and:150-166, with the same shape inchage,chpasswd,chsh,usermod,groupdel, …Fix
UClapError/ClapErrorWrapper) that can express the needed codes — if so, adopt it directly.src/shadow-core/src/cli.rs, e.g.from_clap_error(e, conflict_code, other_code), and call it from eachuumain. Each tool keeps its own domain error enum but drops theAlreadyPrintedvariant and itsDisplay/codearms.Do not collapse the per-tool domain error enums into
USimpleError— their exit codes are GNU-specific and individually documented; only the clap/sentinel plumbing is shared.For newcomers
Depends on the uucore bump (#179) - without it you'll be fighting the old 0.8 API. New to the codebase? Scope your PR to just
passwdfirst; the other 12 tools can follow as separate PRs.