@@ 1,7 1,16 @@
use std::io::Write;
fn main() {
- let exec = std::env::args().skip(1).next().expect("Missing executable");
+ let mut args = std::env::args();
+ let _ = args.next(); // ignore self name
+
+ let exec = match args.next() {
+ None => {
+ println!("Usage: shoved-register EXECUTABLE");
+ std::process::exit(1);
+ }
+ Some(exec) => exec,
+ };
let user_path = {
let mut path = dirs::runtime_dir().unwrap_or_else(|| std::path::PathBuf::from("/tmp"));
@@ 21,7 30,7 @@ fn main() {
_ => Err(err),
},
}
- .unwrap();
+ .expect("Failed to connect to shoved");
stream
.write_all(