Skip to content

Commit

Permalink
dev: better matching of subdirectories with multipart
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrieanKhisbe committed Oct 5, 2017
1 parent fe187e0 commit ac87fa2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions __diraction-dispatch
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ then # Subcomand completion

/*) # Pattern :D

local pattern="${subcommand#/}"
local cmd="cd $dirdir && ls -d -- $pattern*/ 2>/dev/null | sed -E 's:^:/:g' | xargs echo"
compadd -S '' -x "Matching Subdirs:" $(eval $cmd) || _message "No subdir matching"
# Ânote: _directories can't work since / is the leading char
# Â- maybe change behavior if no match
# improve completion valuessss!!!!
local paths=("${(f)$(cd $dirdir && ls -Rd -- **/*/| sed -E 's:^:/:g')}")
_multi_parts -i -X "Matching Subdirs:" / paths || _message "No matching subdir"

return 0
;;
*) # Basic argument
Expand Down

0 comments on commit ac87fa2

Please sign in to comment.