This commit is contained in:
sxyazi 2024-07-18 14:10:12 +08:00
parent ba41a4f112
commit e694560d67
No known key found for this signature in database
3 changed files with 5 additions and 9 deletions

View file

@ -20,6 +20,9 @@ pub struct Args {
#[arg(long)]
pub clear_cache: bool,
/// Use the specified client ID, must be a globally unique number
#[arg(long)]
pub client_id: Option<u64>,
/// Report the specified local events to stdout
#[arg(long)]
pub local_events: Option<String>,
@ -34,8 +37,4 @@ pub struct Args {
/// Print version
#[arg(short = 'V', long)]
pub version: bool,
/// Set the YAZI_ID environment variable (integer)
#[arg(long)]
pub id: Option<u64>,
}

View file

@ -21,8 +21,6 @@ pub struct Boot {
pub flavor_dir: PathBuf,
pub plugin_dir: PathBuf,
pub state_dir: PathBuf,
pub yazi_id: Option<u64>,
}
impl Boot {
@ -186,7 +184,6 @@ impl Default for Boot {
plugin_dir: config_dir.join("plugins"),
config_dir,
state_dir: Xdg::state_dir(),
yazi_id: ARGS.id.clone(),
}
}
}

View file

@ -17,7 +17,7 @@ pub use sendable::*;
use server::*;
pub use state::*;
use stream::*;
use yazi_boot::BOOT;
use yazi_boot::ARGS;
#[cfg(unix)]
pub static USERS_CACHE: yazi_shared::RoCell<uzers::UsersCache> = yazi_shared::RoCell::new();
@ -26,7 +26,7 @@ pub fn init() {
let (tx, rx) = tokio::sync::mpsc::unbounded_channel();
// Client
ID.init(BOOT.yazi_id.unwrap_or(yazi_shared::timestamp_us()));
ID.init(ARGS.client_id.unwrap_or(yazi_shared::timestamp_us()));
PEERS.with(Default::default);
QUEUE_TX.init(tx);
QUEUE_RX.init(rx);