From 32dce72acf8b37e9ef05be7e60da9a6c8c1ec87e Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Fri, 20 Sep 2019 22:33:14 +0200 Subject: [PATCH] Rename install/uninstall to register/unregister --- src/main.rs | 26 +++++++++++++------------- src/{install.rs => sysdaemon.rs} | 31 ++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 24 deletions(-) rename src/{install.rs => sysdaemon.rs} (84%) diff --git a/src/main.rs b/src/main.rs index 151cc5f..45973d0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,7 +51,7 @@ mod bridge; mod engine; mod config; mod system; -mod install; +mod sysdaemon; mod context; mod matcher; mod keyboard; @@ -94,10 +94,10 @@ fn main() { .about("Tool to detect current window properties, to simplify filters creation.")) .subcommand(SubCommand::with_name("daemon") .about("Start the daemon without spawning a new process.")) - .subcommand(SubCommand::with_name("install") - .about("MacOS and Linux only. Register espanso in the system daemon manager.")) - .subcommand(SubCommand::with_name("uninstall") - .about("MacOS and Linux only. Unregister espanso from the system daemon manager.")) + .subcommand(SubCommand::with_name("register") + .about("MacOS only. Register espanso in the system daemon manager.")) + .subcommand(SubCommand::with_name("unregister") + .about("MacOS only. Unregister espanso from the system daemon manager.")) .subcommand(SubCommand::with_name("log") .about("Print the latest daemon logs.")) .subcommand(SubCommand::with_name("start") @@ -155,13 +155,13 @@ fn main() { return; } - if let Some(_) = matches.subcommand_matches("install") { - install_main(config_set); + if let Some(_) = matches.subcommand_matches("register") { + register_main(config_set); return; } - if let Some(_) = matches.subcommand_matches("uninstall") { - uninstall_main(config_set); + if let Some(_) = matches.subcommand_matches("unregister") { + unregister_main(config_set); return; } @@ -543,12 +543,12 @@ fn log_main() { } } -fn install_main(config_set: ConfigSet) { - install::install(config_set); +fn register_main(config_set: ConfigSet) { + sysdaemon::register(config_set); } -fn uninstall_main(config_set: ConfigSet) { - install::uninstall(config_set); +fn unregister_main(config_set: ConfigSet) { + sysdaemon::unregister(config_set); } fn acquire_lock() -> Option { diff --git a/src/install.rs b/src/sysdaemon.rs similarity index 84% rename from src/install.rs rename to src/sysdaemon.rs index bd14c28..2f821ec 100644 --- a/src/install.rs +++ b/src/sysdaemon.rs @@ -23,18 +23,13 @@ use crate::config::ConfigSet; // INSTALLATION -#[cfg(target_os = "linux")] -pub fn install(config_set: ConfigSet) { - // TODO -} - #[cfg(target_os = "macos")] const MAC_PLIST_CONTENT : &str = include_str!("res/mac/com.federicoterzi.espanso.plist"); #[cfg(target_os = "macos")] const MAC_PLIST_FILENAME : &str = "com.federicoterzi.espanso.plist"; #[cfg(target_os = "macos")] -pub fn install(_config_set: ConfigSet) { +pub fn register(_config_set: ConfigSet) { use std::fs::create_dir_all; use std::process::{Command, ExitStatus}; @@ -82,7 +77,7 @@ pub fn install(_config_set: ConfigSet) { } #[cfg(target_os = "macos")] -pub fn uninstall(_config_set: ConfigSet) { +pub fn unregister(_config_set: ConfigSet) { use std::fs::create_dir_all; use std::process::{Command, ExitStatus}; @@ -104,12 +99,26 @@ pub fn uninstall(_config_set: ConfigSet) { } } +// LINUX + +#[cfg(target_os = "linux")] +pub fn register(config_set: ConfigSet) { + println!("Linux does not support automatic system daemon integration."); +} + +#[cfg(target_os = "linux")] +pub fn unregister(config_set: ConfigSet) { + println!("Linux does not support automatic system daemon integration."); +} + +// WINDOWS + #[cfg(target_os = "windows")] -pub fn install(_config_set: ConfigSet) { - println!("Windows does not support system daemon integration.") +pub fn register(_config_set: ConfigSet) { + println!("Windows does not support automatic system daemon integration.") } #[cfg(target_os = "windows")] -pub fn uninstall(_config_set: ConfigSet) { - println!("Windows does not support system daemon integration.") +pub fn unregister(_config_set: ConfigSet) { + println!("Windows does not support automatic system daemon integration.") } \ No newline at end of file