mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-25 22:17:33 +00:00
Fix cd - on fish (#179)
This commit is contained in:
parent
5882bc6c4d
commit
acc9059177
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- `cd -` on fish shells.
|
||||
|
||||
## [0.6.0] - 2021-04-09
|
||||
|
||||
### Added
|
||||
|
@ -174,7 +174,8 @@ eval "$(zoxide init zsh)"
|
||||
|
||||
#### Any POSIX shell
|
||||
|
||||
Add the following line to your configuration file:
|
||||
Add the following line to your configuration file (usually
|
||||
`~/.config/nu/config.toml`):
|
||||
|
||||
```sh
|
||||
eval "$(zoxide init posix --hook prompt)"
|
||||
|
@ -10,7 +10,7 @@ use once_cell::sync::OnceCell;
|
||||
|
||||
use std::io::{self, Write};
|
||||
|
||||
/// Generates shell configuration
|
||||
/// Generate shell configuration
|
||||
#[derive(Clap, Debug)]
|
||||
#[clap(after_help(env_help()))]
|
||||
pub struct Init {
|
||||
|
@ -18,7 +18,13 @@ pub trait Cmd {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clap)]
|
||||
#[clap(about, author, global_setting(AppSettings::GlobalVersion), global_setting(AppSettings::VersionlessSubcommands), version = env!("ZOXIDE_VERSION"))]
|
||||
#[clap(
|
||||
about,
|
||||
author,
|
||||
global_setting(AppSettings::DisableHelpSubcommand),
|
||||
global_setting(AppSettings::GlobalVersion),
|
||||
global_setting(AppSettings::VersionlessSubcommands),
|
||||
version = env!("ZOXIDE_VERSION"))]
|
||||
pub enum App {
|
||||
Add(Add),
|
||||
Import(Import),
|
||||
|
@ -10,7 +10,7 @@ use clap::Clap;
|
||||
|
||||
use std::io::{self, Write};
|
||||
|
||||
/// Searches for a directory
|
||||
/// Search for a directory in the database
|
||||
#[derive(Clap, Debug)]
|
||||
pub struct Query {
|
||||
keywords: Vec<String>,
|
||||
|
@ -10,7 +10,7 @@ use clap::Clap;
|
||||
|
||||
use std::io::Write;
|
||||
|
||||
/// Removes a directory
|
||||
/// Remove a directory from the database
|
||||
#[derive(Clap, Debug)]
|
||||
pub struct Remove {
|
||||
#[clap(conflicts_with = "path", long, short, value_name = "keywords")]
|
||||
|
@ -16,7 +16,10 @@ end
|
||||
|
||||
# cd + custom logic based on the value of _ZO_ECHO.
|
||||
function __zoxide_cd
|
||||
builtin cd $argv
|
||||
{#- We can't use `builtin cd` over here, because fish wraps its builtin cd with
|
||||
a function that adds extra features (such as `cd -`). Using the builtin
|
||||
would make those features stop working. #}
|
||||
cd $argv
|
||||
{%- if echo %}
|
||||
and __zoxide_pwd
|
||||
{%- endif %}
|
||||
@ -52,9 +55,7 @@ function __zoxide_z
|
||||
set argc (count $argv)
|
||||
if test $argc -eq 0
|
||||
__zoxide_cd $HOME
|
||||
else if begin
|
||||
test $argc -eq 1; and test $argv[1] = -
|
||||
end
|
||||
else if test "$argv" = -
|
||||
__zoxide_cd -
|
||||
else if begin
|
||||
test $argc -eq 1; and test -d $argv[1]
|
||||
|
Loading…
Reference in New Issue
Block a user