From 9583c22b2c724ad3c7b26724bbed473f3a3d2e41 Mon Sep 17 00:00:00 2001 From: aNNiMON Date: Tue, 23 Jul 2024 19:54:41 +0300 Subject: [PATCH] Add help argument --- src/main.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main.rs b/src/main.rs index 07c9c48..511af16 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,7 @@ enum Mode { Single(String), TerminateByPid(u32), TerminateByName(String), + Help, } // pkill => all unique processed, excl. svchost @@ -88,6 +89,18 @@ fn main() -> ExitCode { ExitCode::FAILURE } } + Mode::Help => { + let lines = [ + "pkill => all unique processed, excl. system\n", + "pkill => filtered processes by name or it's part\n", + "pkill --all => all processes, incl. system\n", + "pkill --pid => PID of the first occurence\n", + "pkill --kill / => terminate process by its PID or name\n", + "pkill --help => print help\n", + ]; + println!("{}", lines.concat()); + ExitCode::SUCCESS + } } } @@ -96,6 +109,7 @@ fn parse_mode() -> Mode { let mut iter = env::args().skip(1).into_iter(); while let Some(el) = iter.next() { match el.as_str() { + "--help" => mode = Mode::Help, "--all" => { mode = Mode::All; }