Disallow zero parameters for zoxide add
This commit is contained in:
parent
3cc3b88913
commit
96bbc250f5
|
|
@ -12,6 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Manpages for each subcommand.
|
- Manpages for each subcommand.
|
||||||
- Default prompt for Nushell.
|
- Default prompt for Nushell.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- `zoxide remove -i` now accepts multiple selections.
|
||||||
|
- `zoxide add` no longer accepts zero parameters.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- `cd -` on fish shells.
|
- `cd -` on fish shells.
|
||||||
|
|
|
||||||
|
|
@ -11,20 +11,15 @@ use std::path::PathBuf;
|
||||||
/// Add a new directory or increment its rank
|
/// Add a new directory or increment its rank
|
||||||
#[derive(Clap, Debug)]
|
#[derive(Clap, Debug)]
|
||||||
pub struct Add {
|
pub struct Add {
|
||||||
path: Option<PathBuf>,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Cmd for Add {
|
impl Cmd for Add {
|
||||||
fn run(&self) -> Result<()> {
|
fn run(&self) -> Result<()> {
|
||||||
let path = match &self.path {
|
let path = if config::zo_resolve_symlinks() {
|
||||||
Some(path) => {
|
util::canonicalize(&self.path)
|
||||||
if config::zo_resolve_symlinks() {
|
} else {
|
||||||
util::canonicalize(path)
|
util::resolve_path(&self.path)
|
||||||
} else {
|
|
||||||
util::resolve_path(path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None => util::current_dir(),
|
|
||||||
}?;
|
}?;
|
||||||
|
|
||||||
if config::zo_exclude_dirs()?
|
if config::zo_exclude_dirs()?
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ pub trait Cmd {
|
||||||
about,
|
about,
|
||||||
author,
|
author,
|
||||||
after_help = ENV_HELP,
|
after_help = ENV_HELP,
|
||||||
|
global_setting(AppSettings::ColoredHelp),
|
||||||
global_setting(AppSettings::DisableHelpSubcommand),
|
global_setting(AppSettings::DisableHelpSubcommand),
|
||||||
global_setting(AppSettings::GlobalVersion),
|
global_setting(AppSettings::GlobalVersion),
|
||||||
global_setting(AppSettings::VersionlessSubcommands),
|
global_setting(AppSettings::VersionlessSubcommands),
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ if (not (and (builtin:has-env __zoxide_hooked) (builtin:eq (builtin:get-env __zo
|
||||||
{%- when Hook::None %}
|
{%- when Hook::None %}
|
||||||
{{ not_configured }}
|
{{ not_configured }}
|
||||||
{%- when Hook::Prompt %}
|
{%- when Hook::Prompt %}
|
||||||
edit:before-readline = [$@edit:before-readline []{ zoxide add $pwd }]
|
edit:before-readline = [$@edit:before-readline []{ zoxide add -- $pwd }]
|
||||||
{%- when Hook::Pwd %}
|
{%- when Hook::Pwd %}
|
||||||
after-chdir = [$@after-chdir [_]{ zoxide add $pwd }]
|
after-chdir = [$@after-chdir [_]{ zoxide add -- $pwd }]
|
||||||
{%- endmatch %}
|
{%- endmatch %}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue