From d96fc92165069159a977e3d36c50beed88647417 Mon Sep 17 00:00:00 2001 From: David Gus Shields Date: Mon, 11 Sep 2023 14:05:28 -0500 Subject: [PATCH 1/2] change all references to exa to eza --- doc/batpipe.md | 2 +- src/batpipe.sh | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/batpipe.md b/doc/batpipe.md index 1b76af9..ef6532f 100644 --- a/doc/batpipe.md +++ b/doc/batpipe.md @@ -29,7 +29,7 @@ Like [lesspipe](https://github.com/wofr06/lesspipe), `batpipe` is designed to wo | Files | Program | | -------------------- | --------------------------- | -| Directories | `exa`, `ls` | +| Directories | `eza`, `ls` | | `*.tar`, `*.tar.gz` | `tar` | | `*.zip`, `*.jar` | `unzip` | | `*.gz` | `gunzip` | diff --git a/src/batpipe.sh b/src/batpipe.sh index 9f8870b..69019fb 100755 --- a/src/batpipe.sh +++ b/src/batpipe.sh @@ -151,23 +151,23 @@ fi # Viewers: # ----------------------------------------------------------------------------- -BATPIPE_VIEWERS=("exa" "ls" "tar" "unzip" "gunzip" "xz") +BATPIPE_VIEWERS=("eza" "ls" "tar" "unzip" "gunzip" "xz") # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -viewer_exa_supports() { +viewer_eza_supports() { [[ -d "$2" ]] || return 1 - command -v "exa" &> /dev/null || return 1 + command -v "eza" &> /dev/null || return 1 return 0 } -viewer_exa_process() { +viewer_eza_process() { local dir="$(strip_trailing_slashes "$1")" batpipe_header "Viewing contents of directory: %{PATH}%s" "$dir" if "$BATPIPE_ENABLE_COLOR"; then - exa -la --color=always "$1" 2>&1 + eza -la --color=always "$1" 2>&1 else - exa -la --color=never "$1" 2>&1 + eza -la --color=never "$1" 2>&1 fi return $? } From 162c21d0125c0f60a81f52ebb41716c312ac2f44 Mon Sep 17 00:00:00 2001 From: David Gus Shields Date: Mon, 11 Sep 2023 17:18:30 -0500 Subject: [PATCH 2/2] readd exa conditionally --- src/batpipe.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/batpipe.sh b/src/batpipe.sh index 69019fb..2328b48 100755 --- a/src/batpipe.sh +++ b/src/batpipe.sh @@ -151,16 +151,37 @@ fi # Viewers: # ----------------------------------------------------------------------------- -BATPIPE_VIEWERS=("eza" "ls" "tar" "unzip" "gunzip" "xz") +if ! command -v eza &> /dev/null +then + BATPIPE_VIEWERS=("eza" "ls" "tar" "unzip" "gunzip" "xz") +else + BATPIPE_VIEWERS=("exa" "ls" "tar" "unzip" "gunzip" "xz") +fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +viewer_exa_supports() { + [[ -d "$2" ]] || return 1 + command -v "exa" &> /dev/null || return 1 + return 0 +} + viewer_eza_supports() { [[ -d "$2" ]] || return 1 command -v "eza" &> /dev/null || return 1 return 0 } +viewer_exa_process() { + local dir="$(strip_trailing_slashes "$1")" + batpipe_header "Viewing contents of directory: %{PATH}%s" "$dir" + if "$BATPIPE_ENABLE_COLOR"; then + exa -la --color=always "$1" 2>&1 + else + exa -la --color=never "$1" 2>&1 + fi + return $? +} viewer_eza_process() { local dir="$(strip_trailing_slashes "$1")" batpipe_header "Viewing contents of directory: %{PATH}%s" "$dir"