mirror of
				git://git.code.sf.net/p/zsh/code
				synced 2025-11-04 07:21:06 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			333 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			333 B
		
	
	
	
		
			Text
		
	
	
	
	
	
#compdef su
 | 
						|
 | 
						|
local shell comp name usr base
 | 
						|
 | 
						|
[[ $words[2] != - ]]
 | 
						|
(( base=$?+2 ))
 | 
						|
 | 
						|
if [[ CURRENT -eq base ]]; then
 | 
						|
  _users && return
 | 
						|
  usr=root
 | 
						|
elif [[ CURRENT -ge base+1 ]]; then
 | 
						|
  usr=$words[base]
 | 
						|
else
 | 
						|
  return
 | 
						|
fi
 | 
						|
 | 
						|
shell="${${(M@)${(@f)$(</etc/passwd)}:#$usr*}##*:}"
 | 
						|
compset -n $base
 | 
						|
 | 
						|
_dispatch $shell:t $shell $shell:t -default-
 |