aboutsummaryrefslogtreecommitdiff
path: root/files/.lessfilter.sh
blob: b4877947c8d3a8981715276acc8f368b183ead81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

case $1 in
    *.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