Quellcode durchsuchen

Merge pull request #400 from johannesgerer/master

Only use colors if stdout is a terminal.
pull/401/head
William Ting vor 8 Jahren
Ursprung
Commit
7ee214c9c2
2 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen
  1. +5
    -1
      bin/autojump.bash
  2. +5
    -1
      bin/autojump.zsh

+ 5
- 1
bin/autojump.bash Datei anzeigen

@ -61,7 +61,11 @@ j() {
output="$(autojump ${@})"
if [[ -d "${output}" ]]; then
echo -e "\\033[31m${output}\\033[0m"
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"

+ 5
- 1
bin/autojump.zsh Datei anzeigen

@ -52,7 +52,11 @@ j() {
setopt localoptions noautonamedirs
local output="$(autojump ${@})"
if [[ -d "${output}" ]]; then
echo -e "\\033[31m${output}\\033[0m"
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"

Laden…
Abbrechen
Speichern