MCPcopy Create free account
hub / github.com/amnweb/thide / handle_cli_command

Function handle_cli_command

src/cli.rs:12–36  ·  view source on GitHub ↗
(args: &[String])

Source from the content-addressed store, hash-verified

10const IPC_WINDOW_CLASS: &str = "THideIPCWindow";
11
12pub fn handle_cli_command(args: &[String]) -> Result<(), Box<dyn std::error::Error>> {
13 if args.is_empty() {
14 print_usage();
15 return Ok(());
16 }
17
18 match args[0].to_lowercase().as_str() {
19 "start" => start_gui(),
20 "show" => send_command(WM_THIDE_SHOW, "Showing taskbar..."),
21 "hide" => send_command(WM_THIDE_HIDE, "Hiding taskbar..."),
22 "toggle" => send_command(WM_THIDE_TOGGLE, "Toggling taskbar state..."),
23 "stop" | "quit" => send_command(WM_THIDE_QUIT, "Stopping THide..."),
24 "enable-autostart" => enable_autostart(),
25 "disable-autostart" => disable_autostart(),
26 "help" | "--help" | "-h" => {
27 print_usage();
28 Ok(())
29 }
30 _ => {
31 eprintln!("Unknown command: {}", args[0]);
32 print_usage();
33 std::process::exit(1);
34 }
35 }
36}
37
38pub fn get_ipc_window_class() -> &'static str {
39 IPC_WINDOW_CLASS

Callers 1

mainFunction · 0.85

Calls 5

print_usageFunction · 0.85
start_guiFunction · 0.85
send_commandFunction · 0.85
enable_autostartFunction · 0.85
disable_autostartFunction · 0.85

Tested by

no test coverage detected