diff --git a/Maidfile.toml b/Maidfile.toml index d8f13a5f21f0a919f5a8333d994481156cf36912..1737bb307d86498ce0603cf1e3360898359e0981 100644 --- a/Maidfile.toml +++ b/Maidfile.toml @@ -11,3 +11,10 @@ script = [ "cargo zigbuild --release", "cp target/release/pmc bin/pmc" ] + +[tasks.install] +script = [ + "maid build -q", + "sudo cp bin/pmc /usr/local/bin", + "echo Copied binary!" +] diff --git a/src/cli.rs b/src/cli.rs index fb7cd2620a3cd6ce4c54322531f5e8d36c7e8798..32cb63d8d91126058aaf08d0088cc6b7f41d7e99 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -29,11 +29,6 @@ pub fn get_version(short: bool) -> String { pub fn start(name: &Option, args: &Option) { let mut runner = Runner::new(global!("pmc.logs")); - let name = match name { - Some(name) => string!(name), - None => string!(""), - }; - match args { Some(Args::Id(id)) => { println!("{} Applying action restartProcess on ({id})", *helpers::SUCCESS); @@ -43,6 +38,11 @@ pub fn start(name: &Option, args: &Option) { list(&string!("")); } Some(Args::Script(script)) => { + let name = match name { + Some(name) => string!(name), + None => string!(script.split_whitespace().next().unwrap_or_default()), + }; + println!("{} Creating process with ({name})", *helpers::SUCCESS); runner.start(name.clone(), script);