| 
									
										
										
										
											2024-09-25 01:50:43 +08:00
										 |  |  | # Does the quickest output of brew tap possible for no arguments. | 
					
						
							|  |  |  | # HOMEBREW_LIBRARY is set by bin/brew | 
					
						
							|  |  |  | # shellcheck disable=SC2154 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | normalise_tap_name() { | 
					
						
							| 
									
										
										
										
											2024-09-25 16:49:43 +08:00
										 |  |  |   local directory="$1" | 
					
						
							| 
									
										
										
										
											2024-09-25 01:50:43 +08:00
										 |  |  |   local user | 
					
						
							| 
									
										
										
										
											2024-09-25 16:49:43 +08:00
										 |  |  |   local repository | 
					
						
							| 
									
										
										
										
											2024-09-25 01:50:43 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-25 16:49:43 +08:00
										 |  |  |   user="$(tr '[:upper:]' '[:lower:]' <<<"${directory%%/*}")" | 
					
						
							|  |  |  |   repository="$(tr '[:upper:]' '[:lower:]' <<<"${directory#*/}")" | 
					
						
							|  |  |  |   repository="${repository#@(home|linux)brew-}" | 
					
						
							|  |  |  |   echo "${user}/${repository}" | 
					
						
							| 
									
										
										
										
											2024-09-25 01:50:43 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | homebrew-tap() { | 
					
						
							|  |  |  |   local taplib="${HOMEBREW_LIBRARY}/Taps" | 
					
						
							|  |  |  |   ( | 
					
						
							|  |  |  |     shopt -s extglob | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-25 16:49:43 +08:00
										 |  |  |     for directory in "${taplib}"/*/* | 
					
						
							| 
									
										
										
										
											2024-09-25 01:50:43 +08:00
										 |  |  |     do | 
					
						
							| 
									
										
										
										
											2024-09-25 16:49:43 +08:00
										 |  |  |       [[ -d "${directory}" ]] || continue | 
					
						
							|  |  |  |       normalise_tap_name "${directory#"${taplib}"/}" | 
					
						
							| 
									
										
										
										
											2024-09-25 01:50:43 +08:00
										 |  |  |     done | sort | 
					
						
							|  |  |  |   ) | 
					
						
							|  |  |  | } |