mirror of
				https://github.com/ohmyzsh/ohmyzsh.git
				synced 2025-11-04 21:31:19 +08:00 
			
		
		
		
	adb: improve adb -s completion to show helpful info (#7532)
				
					
				
			Currently it shows for example the following: DEVICE_ID -- transport_id:2 which doesn't really ease device selection. I've adapted the awk script to print device name with it's model name, see the example below: DEVICE_ID -- Pixel_3(blueline)
This commit is contained in:
		
							parent
							
								
									424b24761b
								
							
						
					
					
						commit
						dfd1b4f8df
					
				@ -49,7 +49,12 @@ _arguments \
 | 
			
		||||
case "$state" in
 | 
			
		||||
	specify_device)
 | 
			
		||||
	_values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
 | 
			
		||||
		{sub(/ +/," ",$0);gsub(":","\\:",$1); printf "%s[%s] ",$1, $NF}'):-""}
 | 
			
		||||
		{sub(/ +/," ",$0); \
 | 
			
		||||
		gsub(":","\\:",$1); \
 | 
			
		||||
		for(i=1;i<=NF;i++) {
 | 
			
		||||
			if($i ~ /model:/) { split($i,m,":") } \
 | 
			
		||||
			else if($i ~ /product:/) { split($i,p,":") } } \
 | 
			
		||||
		printf "%s[%s(%s)] ",$1, p[2], m[2]}'):-""}
 | 
			
		||||
	return
 | 
			
		||||
	;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user