mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
Merge 9f0826dcf9
into ff75f542ae
This commit is contained in:
commit
d1298d4b28
11
bin/autojump
11
bin/autojump
@ -120,6 +120,10 @@ def parse_arguments():
|
|||||||
'--complete', action='store_true', default=False,
|
'--complete', action='store_true', default=False,
|
||||||
help='used for tab completion',
|
help='used for tab completion',
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--child', action="store_true", default=False,
|
||||||
|
help='only match subdirectories of the current working directory'
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--purge', action='store_true', default=False,
|
'--purge', action='store_true', default=False,
|
||||||
help='remove non-existent paths from database',
|
help='remove non-existent paths from database',
|
||||||
@ -313,6 +317,13 @@ def main(args): # noqa
|
|||||||
tab_needle, tab_index, tab_path = \
|
tab_needle, tab_index, tab_path = \
|
||||||
get_tab_entry_info(first(needles), TAB_SEPARATOR)
|
get_tab_entry_info(first(needles), TAB_SEPARATOR)
|
||||||
|
|
||||||
|
if args.child:
|
||||||
|
pwd = get_pwd()
|
||||||
|
entries = ifilter(
|
||||||
|
lambda entry: entry.path.find(pwd) == 0,
|
||||||
|
entries
|
||||||
|
)
|
||||||
|
|
||||||
# Handle `j foo__`, assuming first index.
|
# Handle `j foo__`, assuming first index.
|
||||||
if not tab_path and not tab_index \
|
if not tab_path and not tab_index \
|
||||||
and tab_needle and needles[0] == tab_needle + TAB_SEPARATOR:
|
and tab_needle and needles[0] == tab_needle + TAB_SEPARATOR:
|
||||||
|
@ -79,10 +79,10 @@ j() {
|
|||||||
# jump to child directory (subdirectory of current path)
|
# jump to child directory (subdirectory of current path)
|
||||||
jc() {
|
jc() {
|
||||||
if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then
|
if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then
|
||||||
autojump ${@}
|
autojump --child ${@}
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
j $(pwd) ${@}
|
j ${@} --child
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,9 +122,9 @@ jo() {
|
|||||||
# open autojump results (child directory) in file browser
|
# open autojump results (child directory) in file browser
|
||||||
jco() {
|
jco() {
|
||||||
if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then
|
if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then
|
||||||
autojump ${@}
|
autojump --child ${@}
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
jo $(pwd) ${@}
|
jo ${@} --child
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -70,12 +70,7 @@ end
|
|||||||
|
|
||||||
# jump to child directory (subdirectory of current path)
|
# jump to child directory (subdirectory of current path)
|
||||||
function jc
|
function jc
|
||||||
switch "$argv"
|
j $argv --child
|
||||||
case '-*'
|
|
||||||
j $argv
|
|
||||||
case '*'
|
|
||||||
j (pwd) $argv
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -103,10 +98,5 @@ end
|
|||||||
|
|
||||||
# open autojump results (child directory) in file browser
|
# open autojump results (child directory) in file browser
|
||||||
function jco
|
function jco
|
||||||
switch "$argv"
|
jo $argv --child
|
||||||
case '-*'
|
|
||||||
j $argv
|
|
||||||
case '*'
|
|
||||||
jo (pwd) $argv
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -73,10 +73,10 @@ j() {
|
|||||||
# jump to child directory (subdirectory of current path)
|
# jump to child directory (subdirectory of current path)
|
||||||
jc() {
|
jc() {
|
||||||
if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then
|
if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then
|
||||||
autojump ${@}
|
autojump --child ${@}
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
j $(pwd) ${@}
|
j ${@} --child
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,9 +117,9 @@ jo() {
|
|||||||
# open autojump results (child directory) in file browser
|
# open autojump results (child directory) in file browser
|
||||||
jco() {
|
jco() {
|
||||||
if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then
|
if [[ ${1} == -* ]] && [[ ${1} != "--" ]]; then
|
||||||
autojump ${@}
|
autojump --child ${@}
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
jo $(pwd) ${@}
|
jo ${@} --child
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user