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.
|
||||
- Default prompt for Nushell.
|
||||
|
||||
### Changed
|
||||
|
||||
- `zoxide remove -i` now accepts multiple selections.
|
||||
- `zoxide add` no longer accepts zero parameters.
|
||||
|
||||
### Fixed
|
||||
|
||||
- `cd -` on fish shells.
|
||||
|
|
|
|||
|
|
@ -11,20 +11,15 @@ use std::path::PathBuf;
|
|||
/// Add a new directory or increment its rank
|
||||
#[derive(Clap, Debug)]
|
||||
pub struct Add {
|
||||
path: Option<PathBuf>,
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
impl Cmd for Add {
|
||||
fn run(&self) -> Result<()> {
|
||||
let path = match &self.path {
|
||||
Some(path) => {
|
||||
if config::zo_resolve_symlinks() {
|
||||
util::canonicalize(path)
|
||||
} else {
|
||||
util::resolve_path(path)
|
||||
}
|
||||
}
|
||||
None => util::current_dir(),
|
||||
let path = if config::zo_resolve_symlinks() {
|
||||
util::canonicalize(&self.path)
|
||||
} else {
|
||||
util::resolve_path(&self.path)
|
||||
}?;
|
||||
|
||||
if config::zo_exclude_dirs()?
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ pub trait Cmd {
|
|||
about,
|
||||
author,
|
||||
after_help = ENV_HELP,
|
||||
global_setting(AppSettings::ColoredHelp),
|
||||
global_setting(AppSettings::DisableHelpSubcommand),
|
||||
global_setting(AppSettings::GlobalVersion),
|
||||
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 %}
|
||||
{{ not_configured }}
|
||||
{%- when Hook::Prompt %}
|
||||
edit:before-readline = [$@edit:before-readline []{ zoxide add $pwd }]
|
||||
edit:before-readline = [$@edit:before-readline []{ zoxide add -- $pwd }]
|
||||
{%- when Hook::Pwd %}
|
||||
after-chdir = [$@after-chdir [_]{ zoxide add $pwd }]
|
||||
after-chdir = [$@after-chdir [_]{ zoxide add -- $pwd }]
|
||||
{%- endmatch %}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue