Skip to content

Commit

Permalink
Add --config for specifying clashtui config dir
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanChane committed Jan 5, 2025
1 parent f4f7f90 commit 7562192
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions clashtui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ pub struct CliEnv {
/// print version information and exit
#[argh(switch, short = 'v')]
pub version: bool,
/// specify the ClashTUI config directory
#[argh(option, short = 'c', long = "config")]
pub config_dir: Option<PathBuf>,
}

pub struct App {
Expand Down
2 changes: 1 addition & 1 deletion clashtui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn main() {
let mut flags = Flags::empty();

// ## Setup logging as early as possible. So We can log.
let config_dir = load_app_dir(&mut flags);
let config_dir = cli_env.config_dir.unwrap_or_else(|| load_app_dir(&mut flags));
setup_logging(config_dir.join("clashtui.log").to_str().unwrap());

let tick_rate = 250; // time in ms between two ticks.
Expand Down

0 comments on commit 7562192

Please sign in to comment.