mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-04 13:33:15 +01:00
Merge branch 'master' into compressed-tar
This commit is contained in:
commit
ba984f470e
@ -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` |
|
||||
|
@ -151,7 +151,12 @@ fi
|
||||
# Viewers:
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
BATPIPE_VIEWERS=("exa" "ls" "tar" "tar_gz" "tar_bz2" "unzip" "gunzip" "xz")
|
||||
if ! command -v eza &> /dev/null
|
||||
then
|
||||
BATPIPE_VIEWERS=("eza" "ls" "tar" "tar_gz" "unzip" "gunzip" "xz")
|
||||
else
|
||||
BATPIPE_VIEWERS=("exa" "ls" "tar" "tar_bz2" "unzip" "gunzip" "xz")
|
||||
fi
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@ -161,6 +166,12 @@ viewer_exa_supports() {
|
||||
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"
|
||||
@ -171,6 +182,16 @@ viewer_exa_process() {
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
viewer_eza_process() {
|
||||
local dir="$(strip_trailing_slashes "$1")"
|
||||
batpipe_header "Viewing contents of directory: %{PATH}%s" "$dir"
|
||||
if "$BATPIPE_ENABLE_COLOR"; then
|
||||
eza -la --color=always "$1" 2>&1
|
||||
else
|
||||
eza -la --color=never "$1" 2>&1
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user