mirror of
				git://git.code.sf.net/p/zsh/code
				synced 2025-10-31 06:00:54 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			552 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			552 B
		
	
	
	
		
			Text
		
	
	
	
	
	
| #compdef getopts read unset vared
 | |
| 
 | |
| # This will handle completion of keys of associative arrays, e.g. at
 | |
| # `vared compconfig[<TAB>'.  However, in this version the [ must be
 | |
| # added by hand.
 | |
| 
 | |
| local expl
 | |
| 
 | |
| if [[ $PREFIX = *\[* ]]; then
 | |
|   local var=${PREFIX%%\[*}
 | |
|   local elt="${PREFIX#*\]}${SUFFIX%\]}"
 | |
|   local addclose
 | |
| 
 | |
|   compset -p $(( ${#var} + 1 ))
 | |
|   if ! compset -S \]; then
 | |
|     addclose=(-S ']')
 | |
|   fi
 | |
|   if [[ ${(tP)var} = assoc* ]]; then
 | |
|     _description expl 'association key'
 | |
|     compadd "$expl[@]" $addclose - ${(kP)var}
 | |
|   fi
 | |
| else
 | |
|   _parameter
 | |
| fi
 |