mirror of
https://github.com/TheM1Stery/dotfiles.git
synced 2025-04-20 00:51:11 +00:00
feat: add children traversal support for cdf
This commit is contained in:
parent
28b3628442
commit
3ec5735dc4
17
zsh/.profile
17
zsh/.profile
@ -87,14 +87,26 @@ _check_hidden_arg(){
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_check_ancestor_arg() {
|
||||||
|
if [[ "$1" = "-a" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# need to clean this up(TODO)
|
# need to clean this up(TODO)
|
||||||
cdf(){
|
cdf(){
|
||||||
arg=$1
|
arg=$1
|
||||||
hidden=false
|
hidden=false
|
||||||
|
ansector=false
|
||||||
if _check_hidden_arg "$arg"; then
|
if _check_hidden_arg "$arg"; then
|
||||||
hidden=true
|
hidden=true
|
||||||
arg=$2
|
arg=$2
|
||||||
fi
|
fi
|
||||||
|
if _check_ancestor_arg "$arg"; then
|
||||||
|
ancestor=true
|
||||||
|
arg=$2
|
||||||
|
fi
|
||||||
if [ -z "$arg" ]; then
|
if [ -z "$arg" ]; then
|
||||||
if $hidden; then
|
if $hidden; then
|
||||||
result="$($FZF_DEFAULT_COMMAND --type d --hidden | fzf)"
|
result="$($FZF_DEFAULT_COMMAND --type d --hidden | fzf)"
|
||||||
@ -111,7 +123,10 @@ cdf(){
|
|||||||
echo "Not a directory or empty"
|
echo "Not a directory or empty"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fd_command="fd . $arg --type d --max-depth 1"
|
fd_command="fd . $arg --type d"
|
||||||
|
if ! $ancestor; then
|
||||||
|
fd_command="$fd_command --max-depth 1"
|
||||||
|
fi
|
||||||
if $hidden; then
|
if $hidden; then
|
||||||
fd_command="$fd_command --hidden"
|
fd_command="$fd_command --hidden"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user