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.
pull/131/head
William Ting 12 years ago
parent d194429782
commit 32566eb89d

@ -131,7 +131,7 @@ Options must be passed to 'autojump' and not the 'j' wrapper function.
--purge deletes database entries that no longer exist on system
--stat show database entries and their key weights
-s, --stat show database entries and their key weights
--version show version information and exit
@ -189,6 +189,8 @@ ADVANCED USAGE
KNOWN ISSUES
------------
- Does not support directories that begin with `-`.
- zsh (bug \#86)
Tab completion does not work.

@ -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}"

@ -37,7 +37,7 @@ wrapper function.
--purge\ \ \ \ \ \ \ \ \ \ \ \ \ deletes\ database\ entries\ that\ no\ longer\ exist\ on\ system
--stat\ \ \ \ \ \ \ \ \ \ \ \ \ \ show\ database\ entries\ and\ their\ key\ weights
-s,\ --stat\ \ \ \ \ \ \ \ \ \ \ \ \ \ show\ database\ entries\ and\ their\ key\ weights
--version\ \ \ \ \ \ \ \ \ \ \ show\ version\ information\ and\ exit
\f[]
@ -120,6 +120,8 @@ All negative key weights are purged automatically.
.RE
.SS KNOWN ISSUES
.IP \[bu] 2
Does not support directories that begin with \f[C]-\f[].
.IP \[bu] 2
zsh (bug #86)
.RS 2
.PP

@ -6,7 +6,7 @@ Options must be passed to 'autojump' and not the 'j' wrapper function.
--purge deletes database entries that no longer exist on system
--stat show database entries and their key weights
-s, --stat show database entries and their key weights
--version show version information and exit
@ -48,6 +48,8 @@ Options must be passed to 'autojump' and not the 'j' wrapper function.
## KNOWN ISSUES
- Does not support directories that begin with `-`.
- zsh (bug #86)
Tab completion does not work.

Loading…
Cancel
Save