mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-17 02:25:15 +00:00
Add --no-define-aliases flag to zoxide init
This commit is contained in:
parent
f0c5e28fd7
commit
34ab8f3f8b
@ -61,6 +61,8 @@ If you want the interactive fuzzy selection feature, you will also need to insta
|
||||
|
||||
### Step 2: Adding `zoxide` to your shell
|
||||
|
||||
By default, `zoxide` defines the `z`, `zi`, `za`, `zq`, and `zr` aliases. If you'd like to go with just the barebones `z`, pass the `--no-define-aliases` flag to `zoxide init`.
|
||||
|
||||
#### zsh
|
||||
|
||||
Add the following line to your `~/.zshrc`:
|
||||
|
19
src/main.rs
19
src/main.rs
@ -34,6 +34,8 @@ enum Zoxide {
|
||||
Init {
|
||||
#[structopt(possible_values = &Shell::variants(), case_insensitive = true)]
|
||||
shell: Shell,
|
||||
#[structopt(long, help = "Prevents zoxide from defining any aliases other than 'z'")]
|
||||
no_define_aliases: bool,
|
||||
},
|
||||
|
||||
#[structopt(about = "Search for a directory")]
|
||||
@ -92,19 +94,28 @@ pub fn main() -> Result<()> {
|
||||
|
||||
db.save()?;
|
||||
}
|
||||
Zoxide::Init { shell } => {
|
||||
Zoxide::Init {
|
||||
shell,
|
||||
no_define_aliases,
|
||||
} => {
|
||||
match shell {
|
||||
Shell::bash => {
|
||||
println!("{}", INIT_BASH);
|
||||
println!("{}", INIT_BASH_ALIAS);
|
||||
if !no_define_aliases {
|
||||
println!("{}", INIT_BASH_ALIAS);
|
||||
}
|
||||
}
|
||||
Shell::fish => {
|
||||
println!("{}", INIT_FISH);
|
||||
println!("{}", INIT_FISH_ALIAS);
|
||||
if !no_define_aliases {
|
||||
println!("{}", INIT_FISH_ALIAS);
|
||||
}
|
||||
}
|
||||
Shell::zsh => {
|
||||
println!("{}", INIT_ZSH);
|
||||
println!("{}", INIT_ZSH_ALIAS);
|
||||
if !no_define_aliases {
|
||||
println!("{}", INIT_ZSH_ALIAS);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user