mirror of
				git://git.code.sf.net/p/zsh/code
				synced 2025-10-31 18:10:56 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
	
		
			400 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			400 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)}:#root*}##*:}"
 | |
| compset -n $base
 | |
| for name in $shell $shell:t -default-; do
 | |
|   comp="$_comps[$name]"
 | |
|   [[ -n "$comp" ]] && "$comp" && return
 | |
| done  
 |