diff --git a/src/bin/clashtui/commands.rs b/src/bin/clashtui/commands.rs index adf348a..8c1953d 100644 --- a/src/bin/clashtui/commands.rs +++ b/src/bin/clashtui/commands.rs @@ -92,7 +92,7 @@ struct ProfileUpdate { name: Option, /// update profile with proxy #[arg(long)] - with_proxy: bool, + with_proxy: Option, } /// select profile #[derive(clap::Args)] diff --git a/src/bin/clashtui/commands/handler.rs b/src/bin/clashtui/commands/handler.rs index f80bc0f..c07b16d 100644 --- a/src/bin/clashtui/commands/handler.rs +++ b/src/bin/clashtui/commands/handler.rs @@ -5,6 +5,9 @@ use crate::utils::BackEnd; use super::*; pub fn handle_cli(command: PackedArgs, backend: BackEnd) -> anyhow::Result { + // let var: Option = std::env::var("CLASHTUI_") + // .ok() + // .and_then(|s| s.parse().ok()); let PackedArgs(command) = command; match command { ArgCommand::Profile(Profile { command }) => match command { @@ -20,7 +23,7 @@ pub fn handle_cli(command: PackedArgs, backend: BackEnd) -> anyhow::Result anyhow::Result { v.into_iter().for_each(|s| println!("- {s}")); } @@ -73,19 +76,6 @@ pub fn handle_cli(command: PackedArgs, backend: BackEnd) -> anyhow::Result Ok(backend.clash_srv_ctl(ServiceOp::StopClashService)?), }, - #[cfg(any(target_os = "linux", target_os = "macos"))] - ArgCommand::Mode(Mode { command }) => match command { - ModeCommand::Rule => Ok(backend - .update_state(None, Some(cMode::Rule.into()))? - .to_string()), - ModeCommand::Direct => Ok(backend - .update_state(None, Some(cMode::Direct.into()))? - .to_string()), - ModeCommand::Global => Ok(backend - .update_state(None, Some(cMode::Global.into()))? - .to_string()), - }, - #[cfg(target_os = "windows")] ArgCommand::Mode(Mode { command }) => match command { ModeCommand::Rule => Ok(backend .update_state(None, Some(cMode::Rule.into()))?