mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-10-31 07:04:04 +00:00 
			
		
		
		
	Add cat alias detection to info.sh (#911)
This commit is contained in:
		| @@ -71,27 +71,34 @@ _bat_wrapper_:run() { | |||||||
| } | } | ||||||
|  |  | ||||||
| _bat_wrapper_function_:run() { | _bat_wrapper_function_:run() { | ||||||
| 	case "$("$SHELL" --version | head -n 1)" in | 	_bat_wrapper_function_:detect_wrapper() { | ||||||
| 		*fish*) | 		local command="$1" | ||||||
| 			if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then | 		case "$("$SHELL" --version | head -n 1)" in | ||||||
| 				_out_fence "$SHELL" --login -c 'functions bat' | 			*fish*) | ||||||
| 				return | 				if "$SHELL" --login -i -c "type ${command}" 2>&1 | grep 'function' &>/dev/null; then | ||||||
| 			fi | 					_out_fence "$SHELL" --login -i -c "functions ${command}" | ||||||
| 			;; | 					return | ||||||
|  | 				fi ;; | ||||||
|  |  | ||||||
| 		*bash* | *zsh*) | 			*bash*|*zsh*) | ||||||
| 			if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then | 				local type="$("$SHELL" --login -i -c "type ${command}" 2>&1)" | ||||||
| 				_out_fence "$SHELL" --login -i -c 'declare -f bat' | 				if grep 'function' <<< "$type" &>/dev/null; then | ||||||
| 				return | 					_out_fence "$SHELL" --login -i -c "declare -f ${command}" | ||||||
| 			fi | 					return | ||||||
| 			;; | 				elif grep 'alias' <<< "$type" &>/dev/null; then | ||||||
|  | 					_out_fence "$SHELL" --login -i -c "type ${command}" | ||||||
|  | 					return | ||||||
|  | 				fi ;; | ||||||
|  |  | ||||||
| 		*) | 			*) | ||||||
| 			echo "Unable to determine if a wrapper function is set." | 				echo "Unable to determine if a wrapper function for '${command}' is set." | ||||||
| 			return | 				return ;; | ||||||
| 			;; | 		esac | ||||||
| 	esac | 		printf "\nNo wrapper function for '%s'.\n" "${command}" | ||||||
| 	printf "\nNo wrapper function.\n" | 	} | ||||||
|  |  | ||||||
|  | 	_bat_wrapper_function_:detect_wrapper bat | ||||||
|  | 	_bat_wrapper_function_:detect_wrapper cat | ||||||
| } | } | ||||||
|  |  | ||||||
| _system_:run() { | _system_:run() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user