mirror of
https://github.com/wting/autojump
synced 2026-03-02 03:49:26 +00:00
Implements #126. Options passed to j will now be parsed. -s short option for
--stat added, jumpstat alias removed. Options passed to the `j` function will now be passed on autojump. As a result, directories beginning with `-` are no longer supported. A -s short alias for --stat is added. Instead of using jumpstat, use `j --stat` or `j -s` instead.
This commit is contained in:
@@ -29,7 +29,7 @@ import shutil
|
||||
import sys
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
VERSION = 'release-v20-7'
|
||||
VERSION = 'release-v20-8'
|
||||
MAX_KEYWEIGHT = 1000
|
||||
MAX_STORED_PATHS = 1000
|
||||
COMPLETION_SEPARATOR = '__'
|
||||
@@ -235,7 +235,7 @@ def options():
|
||||
help='used for bash tab completion')
|
||||
parser.add_argument('--purge', action="store_true", default=False,
|
||||
help='delete all database entries that no longer exist on system')
|
||||
parser.add_argument('--stat', action="store_true", default=False,
|
||||
parser.add_argument('-s', '--stat', action="store_true", default=False,
|
||||
help='show database entries and their key weights')
|
||||
parser.add_argument('--version', action="version", version="%(prog)s " + VERSION,
|
||||
help='show version information and exit')
|
||||
|
||||
@@ -62,11 +62,13 @@ case $PROMPT_COMMAND in
|
||||
*) export PROMPT_COMMAND="$AUTOJUMP ; ${PROMPT_COMMAND:-:}";;
|
||||
esac
|
||||
|
||||
alias jumpstat="autojump --stat"
|
||||
|
||||
function j {
|
||||
new_path="$(autojump $@)"
|
||||
if [[ ${@} =~ -.* ]]; then
|
||||
autojump ${@}
|
||||
return
|
||||
fi
|
||||
|
||||
new_path="$(autojump $@)"
|
||||
if [ -d "${new_path}" ]; then
|
||||
echo -e "\\033[31m${new_path}\\033[0m"
|
||||
cd "${new_path}"
|
||||
|
||||
@@ -41,11 +41,20 @@ function autojump_preexec() {
|
||||
typeset -ga preexec_functions
|
||||
preexec_functions+=autojump_preexec
|
||||
|
||||
alias jumpstat="autojump --stat"
|
||||
|
||||
function j {
|
||||
local new_path="$(autojump $@)"
|
||||
if is-at-least 4.3.5; then
|
||||
if [[ ${@} =~ -.* ]]; then
|
||||
autojump ${@}
|
||||
return
|
||||
fi
|
||||
else
|
||||
if [[ ${@} -pcre-match -.* ]]; then
|
||||
autojump ${@}
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
local new_path="$(autojump $@)"
|
||||
if [ -d "${new_path}" ]; then
|
||||
echo -e "\\033[31m${new_path}\\033[0m"
|
||||
cd "${new_path}"
|
||||
|
||||
Reference in New Issue
Block a user