Rename install/uninstall to register/unregister

This commit is contained in:
Federico Terzi 2019-09-20 22:33:14 +02:00
parent ab824a62ac
commit 32dce72acf
2 changed files with 33 additions and 24 deletions

View File

@ -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<File> {

View File

@ -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.")
}