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
|
||||
}
|
||||
|
||||
_check_ancestor_arg() {
|
||||
if [[ "$1" = "-a" ]]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# need to clean this up(TODO)
|
||||
cdf(){
|
||||
arg=$1
|
||||
hidden=false
|
||||
ansector=false
|
||||
if _check_hidden_arg "$arg"; then
|
||||
hidden=true
|
||||
arg=$2
|
||||
fi
|
||||
if _check_ancestor_arg "$arg"; then
|
||||
ancestor=true
|
||||
arg=$2
|
||||
fi
|
||||
if [ -z "$arg" ]; then
|
||||
if $hidden; then
|
||||
result="$($FZF_DEFAULT_COMMAND --type d --hidden | fzf)"
|
||||
@ -111,7 +123,10 @@ cdf(){
|
||||
echo "Not a directory or empty"
|
||||
return 1
|
||||
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
|
||||
fd_command="$fd_command --hidden"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user