Skip to content

Commit

Permalink
Complete path attributes one by one
Browse files Browse the repository at this point in the history
Had to use _sep_parts, instead of the more obvious _multi_parts since it used
far too long processing the array.

Fixes #6  Make nix-build completions more like path completions
  • Loading branch information
hedning committed Nov 6, 2017
1 parent 3b1db52 commit 4f404af
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions _nix-common-options
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,14 @@ _nix_attr_paths () {
return 1
fi

local prefix
local -a prefix=()
if [[ -n $attr_path ]]; then
prefix=${attr_path}.
for i in ${=attr_path/./ }; do
prefix+=("($i)" .)
done
fi

_values -s . "Packages" ${prefix}${^result}
_wanted package package "Attribute path to package" _sep_parts $prefix result \.
}

_nix_profiles () {
Expand Down

0 comments on commit 4f404af

Please sign in to comment.