浏览代码

Merge pull request #400 from johannesgerer/master

Only use colors if stdout is a terminal.
pull/401/head
William Ting 8 年前
父节点
当前提交
7ee214c9c2
共有 2 个文件被更改,包括 10 次插入2 次删除
  1. +5
    -1
      bin/autojump.bash
  2. +5
    -1
      bin/autojump.zsh

+ 5
- 1
bin/autojump.bash 查看文件

@ -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 查看文件

@ -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"

正在加载...
取消
保存