Rename --z-cmd flag to --cmd
This commit is contained in:
parent
f19aa07145
commit
e0572a4569
|
@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Canonicalize to regular paths instead of UNC paths on Windows.
|
||||
- `zoxide init` now uses PWD hooks by default for better performance.
|
||||
- `$_ZO_ECHO` now only works when set to `1`.
|
||||
- Using the `--z-cmd` flag now also renames the associated aliases.
|
||||
- The `--z-cmd` flag has been renamed to `--cmd`.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -15,9 +15,10 @@ pub struct Init {
|
|||
#[structopt(
|
||||
long,
|
||||
help = "Changes the name of the 'z' command",
|
||||
alias = "z-cmd",
|
||||
default_value = "z"
|
||||
)]
|
||||
z_cmd: String,
|
||||
cmd: String,
|
||||
|
||||
#[structopt(
|
||||
long,
|
||||
|
@ -48,11 +49,11 @@ impl Init {
|
|||
let mut handle = stdout.lock();
|
||||
|
||||
let z = config.z;
|
||||
writeln!(handle, "{}", z(&self.z_cmd)).unwrap();
|
||||
writeln!(handle, "{}", z(&self.cmd)).unwrap();
|
||||
|
||||
if !self.no_define_aliases {
|
||||
let alias = config.alias;
|
||||
writeln!(handle, "{}", alias(&self.z_cmd)).unwrap();
|
||||
writeln!(handle, "{}", alias(&self.cmd)).unwrap();
|
||||
}
|
||||
|
||||
match self.hook {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use super::{ShellConfig, HookConfig};
|
||||
use super::{HookConfig, ShellConfig};
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ pub const CONFIG: ShellConfig = ShellConfig {
|
|||
},
|
||||
};
|
||||
|
||||
fn z(z_cmd: &str) -> String {
|
||||
fn z(cmd: &str) -> String {
|
||||
format!(
|
||||
r#"
|
||||
_z_cd() {{
|
||||
|
@ -45,11 +45,11 @@ _z_cd() {{
|
|||
fi
|
||||
}}
|
||||
"#,
|
||||
z_cmd
|
||||
cmd
|
||||
)
|
||||
}
|
||||
|
||||
fn alias(z_cmd: &str) -> String {
|
||||
fn alias(cmd: &str) -> String {
|
||||
format!(
|
||||
r#"
|
||||
alias {0}i='{0} -i'
|
||||
|
@ -62,7 +62,7 @@ alias {0}qi='zoxide query -i'
|
|||
alias {0}r='zoxide remove'
|
||||
alias {0}ri='zoxide remove -i'
|
||||
"#,
|
||||
z_cmd
|
||||
cmd
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue