Removed help menus for `z` and `zri` functions

This commit is contained in:
Ajeet D'Souza 2020-05-28 05:15:06 +05:30
parent e1c1570174
commit 9b056fb58c
5 changed files with 19 additions and 34 deletions

View File

@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `zri` is now a shell function. - `zri` is now a shell function.
### Removed
- Help menus for `z` and `zri`.
## [0.4.1] - 2020-05-25 ## [0.4.1] - 2020-05-25
### Added ### Added

View File

@ -20,7 +20,8 @@ pub fn zo_data_dir() -> Result<PathBuf> {
// This will fail when `data_dir` points to a file or a broken symlink, but // This will fail when `data_dir` points to a file or a broken symlink, but
// will no-op on a valid symlink (to a directory), or an actual directory. // will no-op on a valid symlink (to a directory), or an actual directory.
fs::create_dir_all(&data_dir).context("could not create data directory")?; fs::create_dir_all(&data_dir)
.with_context(|| format!("could not create data directory: {}", data_dir.display()))?;
Ok(data_dir) Ok(data_dir)
} }

View File

@ -32,23 +32,11 @@ function {}
if test $argc -eq 0 if test $argc -eq 0
_z_cd $HOME _z_cd $HOME
or return $status else if begin; test $argc -eq 1; and test $argv[1] = '-'; end
else if test $argc -eq 1 -a $argv[1] = '-'
_z_cd - _z_cd -
or return $status
else else
# FIXME: use string-collect from fish 3.1.0 once it has wider adoption set -l _zoxide_result (zoxide query -- $argv)
set -l IFS '' and _z_cd $_zoxide_result
set -l _zoxide_result (zoxide query $argv)
if test -d $_zoxide_result; and string length -q -- $_zoxide_result
_z_cd $_zoxide_result
or return $status
else if test -n "$_zoxide_result"
echo $_zoxide_result
end
end end
end end
"#, "#,
@ -68,8 +56,8 @@ abbr -a {0}qi 'zoxide query -i'
abbr -a {0}r 'zoxide remove' abbr -a {0}r 'zoxide remove'
function {0}ri function {0}ri
set result (zoxide query -i $argv) set -l _zoxide_result (zoxide query -i -- $argv)
and zoxide remove $result and zoxide remove $_zoxide_result
end end
"#, "#,
cmd cmd

View File

@ -28,22 +28,16 @@ _z_cd() {{
{}() {{ {}() {{
if [ "$#" -eq 0 ]; then if [ "$#" -eq 0 ]; then
_z_cd ~ || return "$?" _z_cd ~
elif [ "$#" -eq 1 ] && [ "$1" = '-' ]; then elif [ "$#" -eq 1 ] && [ "$1" = '-' ]; then
if [ -n "$OLDPWD" ]; then if [ -n "$OLDPWD" ]; then
_z_cd "$OLDPWD" || return "$?" _z_cd "$OLDPWD"
else else
echo 'zoxide: $OLDPWD is not set' echo 'zoxide: $OLDPWD is not set'
return 1 return 1
fi fi
else else
_zoxide_result="$(zoxide query "$@")" || return "$?" _zoxide_result="$(zoxide query -- "$@")" && _z_cd "$_zoxide_result"
if [ -d "$_zoxide_result" ]; then
_z_cd "$_zoxide_result" || return "$?"
elif [ -n "$_zoxide_result" ]; then
echo "$_zoxide_result"
fi
unset _zoxide_result
fi fi
}} }}
"#, "#,
@ -63,7 +57,7 @@ alias {0}qi='zoxide query -i'
alias {0}r='zoxide remove' alias {0}r='zoxide remove'
{0}ri() {{ {0}ri() {{
result=$(zoxide query -i "$@") && zoxide remove "$result" _zoxide_result="$(zoxide query -i -- "$@")" && zoxide remove "$_zoxide_result"
}} }}
"#, "#,
cmd cmd

View File

@ -31,11 +31,9 @@ function {} {{
z_cd - z_cd -
}} }}
else {{ else {{
$_zoxide_result = zoxide query @args $_zoxide_result = zoxide query -- @args
if ($LASTEXITCODE -eq 0 -and $_zoxide_result -is [string] -and (Test-Path $_zoxide_result)) {{ if ($LASTEXITCODE -eq 0) {{
z_cd $_zoxide_result z_cd $_zoxide_result
}} else {{
$_zoxide_result
}} }}
}} }}
}} }}
@ -56,9 +54,9 @@ function {0}qi {{ zoxide query -i @args }}
function {0}r {{ zoxide remove @args }} function {0}r {{ zoxide remove @args }}
function {0}ri {{ function {0}ri {{
$result = zoxide query -i @args $_zoxide_result = zoxide query -i -- @args
if ($LASTEXITCODE -eq 0) {{ if ($LASTEXITCODE -eq 0) {{
zoxide remove $result zoxide remove $_zoxide_result
}} }}
}} }}
"#, "#,