diff options
| author | Anton Bobov <abobov@gmail.com> | 2020-02-04 23:08:59 +0500 |
|---|---|---|
| committer | Anton Bobov <abobov@gmail.com> | 2020-02-04 23:08:59 +0500 |
| commit | 2a063c9edf44ff4e5824a4b73e617c0bd321fb36 (patch) | |
| tree | bed679ef3b501ebfb4ed305552e826ee8d09f019 /files | |
| parent | b00908d513f35dbee98c52b6609cfceaa6eae371 (diff) | |
Updates.
Diffstat (limited to 'files')
| -rwxr-xr-x | files/.lessfilter.sh | 26 | ||||
| -rw-r--r-- | files/.zsh/rc/S50_aliases | 6 |
2 files changed, 24 insertions, 8 deletions
diff --git a/files/.lessfilter.sh b/files/.lessfilter.sh index 9580bf6..b487794 100755 --- a/files/.lessfilter.sh +++ b/files/.lessfilter.sh @@ -1,10 +1,26 @@ -#!/bin/sh +#!/bin/bash case $1 in - *.xml) if [ -x `which xmlstarlet 2>/dev/null` ]; then exec xmlstarlet fo "$1"; fi ;; - *.json) if [ -x `which jq 2>/dev/null` ]; then exec jq -C . "$1"; fi ;; - *.md) if [ -x `which pandoc 2>/dev/null` ]; then exec pandoc -t plain "$1"; fi ;; - *) exec /bin/lesspipe "$1";; + *.xml) + if [ -x "$(command -v xmlstarlet)" ]; then + exec xmlstarlet fo "$1" + fi + ;; + *.json) + if [ -x "$(command -v jq)" ]; then + exec jq -C . "$1" + elif [ -x "$(command -v python)" ] ; then + exec python -m json.tool "$1" + fi + ;; + *.md) + if [ -x "$(command -v pandoc)" ]; then + exec pandoc -t plain "$1" + fi + ;; + *) + exec /bin/lesspipe "$1" + ;; esac exit 1 diff --git a/files/.zsh/rc/S50_aliases b/files/.zsh/rc/S50_aliases index c8923ca..2df9d82 100644 --- a/files/.zsh/rc/S50_aliases +++ b/files/.zsh/rc/S50_aliases @@ -116,15 +116,15 @@ function dc-stats() { alias portcheck='nc -z -v -w 5' alias jq='jq --color-output' -if $(which colordiff >/dev/null) ; then +if [ -x "$(command -v colordiff)" ] ; then alias diff='colordiff -u' else alias diff='diff -u' fi -if $(which unoconv >/dev/null) ; then +if [ -x "$(command -v unoconv)" ] ; then alias 2pdf='unoconv --format pdf' -elif $(which libreoffice >/dev/null) ; then +elif [ -x "$(command -v libreoffice)" ] ; then alias 2pdf='libreoffice --headless --convert-to pdf' fi |
