Update bookmark.zsh
This commit is contained in:
parent
6433a7bdbf
commit
cadec731af
@ -16,7 +16,8 @@ function bm {
|
||||
[ "${#}" -eq 0 ] && { __zsh_list_bookmarks; return }
|
||||
# Otherwise, goto the bookmark in argv[1]
|
||||
__zsh_check_bookmark_name "${1}" || { echo "No such bookmark: '${1}'!"; return 1 }
|
||||
[ -e "${ZSH_BOOKMARK_DIR}/${1}" ] || { echo "No such bookmark: '${1}'!"; return 1 }
|
||||
[ -L "${ZSH_BOOKMARK_DIR}/${1}" ] || { echo "No such bookmark: '${1}'!"; return 1 }
|
||||
[ -e "${ZSH_BOOKMARK_DIR}/${1}" ] || { echo "The bookmark '${1}' refers to a non-existant file!"; return 1 }
|
||||
cd -P "${ZSH_BOOKMARK_DIR}/${1}"
|
||||
[[ -v ZSH_BOOKMARK_LS ]] && "${ZSH_BOOKMARK_LS}" && ls
|
||||
}
|
||||
@ -36,7 +37,7 @@ function bmadd {
|
||||
local real_path="$(realpath "${2}")"
|
||||
local bm_name="${1}"
|
||||
__zsh_check_bookmark_name "${bm_name}" || { echo "Invalid bookmark: '${1}'!"; return 1 }
|
||||
if [ -e "${ZSH_BOOKMARK_DIR}/${bm_name}" ]; then
|
||||
if [ -L "${ZSH_BOOKMARK_DIR}/${bm_name}" ]; then
|
||||
echo "A bookmark with the name '${bm_name}' already exists!"
|
||||
local reply
|
||||
read -q 'reply?Overwrite? [y/N] '
|
||||
@ -51,7 +52,7 @@ function bmadd {
|
||||
function bmrm {
|
||||
[ "${#}" -eq 0 ] && { echo "usage: bmrm <name>"; return 1 }
|
||||
__zsh_check_bookmark_name "${1}" || { echo "No bookmark with the name '${1}' exists!"; return 1 }
|
||||
[ -e "${ZSH_BOOKMARK_DIR}/${1}" ] || { echo "No bookmark with the name '${1}' exists!"; return 1 }
|
||||
[ -L "${ZSH_BOOKMARK_DIR}/${1}" ] || { echo "No bookmark with the name '${1}' exists!"; return 1 }
|
||||
local reply
|
||||
read -q 'reply?Really delete? [y/N] '
|
||||
printf '\n'
|
||||
|
Loading…
Reference in New Issue
Block a user