Exitcode
Preferred system exit codes as defined by sysexits.h
Install / Use
/learn @benwilber/ExitcodeREADME
exitcode
System exit code constants as defined by sysexits.h
Documentation is available here
Installing from crates.io
[dependencies]
exitcode = "1.1.2"
Example
extern crate exitcode;
use std::process;
pub fn parse_int_or_return_error_exitcode(s: String) -> Result<i32, exitcode::ExitCode> {
match s.parse::<i32>() {
Ok(i) => Ok(i),
Err(_) => Err(exitcode::USAGE)
}
}
pub fn main() {
match parse_int_or_return_error_exitcode("123".to_string()) {
Ok(i) => println!("Parsed: {}", i),
Err(code) => {
println!("Parse error. Exiting with code: {}", code);
process::exit(code);
}
}
match parse_int_or_return_error_exitcode("foo".to_string()) {
Ok(i) => println!("Parsed: {}", i),
Err(code) => {
println!("Parse error. Exiting with code: {}", code);
process::exit(code);
}
}
println!("Exiting with code: {}", exitcode::OK);
process::exit(exitcode::OK);
}
Related Skills
himalaya
345.9kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
taskflow
345.9kname: taskflow description: Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layer
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
