mirror of
				https://github.com/wting/autojump
				synced 2025-06-13 12:54:07 +00:00 
			
		
		
		
	only use colors if stdout is a terminal
This commit is contained in:
		
							parent
							
								
									f26a38e0f9
								
							
						
					
					
						commit
						8fa8b06349
					
				@ -61,7 +61,11 @@ j() {
 | 
			
		||||
 | 
			
		||||
    output="$(autojump ${@})"
 | 
			
		||||
    if [[ -d "${output}" ]]; then
 | 
			
		||||
				if [ -t 1 ]; then  # if stdout is a terminal, use colors
 | 
			
		||||
						echo -e "\\033[31m${output}\\033[0m"
 | 
			
		||||
				else
 | 
			
		||||
						echo -e "${output}"
 | 
			
		||||
				fi
 | 
			
		||||
        cd "${output}"
 | 
			
		||||
    else
 | 
			
		||||
        echo "autojump: directory '${@}' not found"
 | 
			
		||||
 | 
			
		||||
@ -52,7 +52,11 @@ j() {
 | 
			
		||||
    setopt localoptions noautonamedirs
 | 
			
		||||
    local output="$(autojump ${@})"
 | 
			
		||||
    if [[ -d "${output}" ]]; then
 | 
			
		||||
				if [ -t 1 ]; then  # if stdout is a terminal, use colors
 | 
			
		||||
						echo -e "\\033[31m${output}\\033[0m"
 | 
			
		||||
				else
 | 
			
		||||
						echo -e "${output}"
 | 
			
		||||
				fi
 | 
			
		||||
        cd "${output}"
 | 
			
		||||
    else
 | 
			
		||||
        echo "autojump: directory '${@}' not found"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user