diff --git a/inc/file-management b/inc/file-management index 788b1ca..a8f968b 100644 --- a/inc/file-management +++ b/inc/file-management @@ -117,6 +117,6 @@ viewFile(){ filename="$(findFile "$id")" - bat --color=always --style=full "$filename" + "$pager" "$filename" } diff --git a/kb b/kb index 030a443..7084458 100755 --- a/kb +++ b/kb @@ -89,6 +89,11 @@ args=() dataDir="${XDG_DATA_HOME:=$HOME/.local/share}/kb/" sqliteFile="" editor="${EDITOR:=vim}" +if type -p bat > /dev/null 2>&1; then + pager="bat" +else + pager="${PAGER:=cat}" +fi # Check for Dependencies # ----------------------------------- @@ -373,6 +378,8 @@ usage() { -h, --help Display this help and exit --data The knowledgebase data dir --sqlite The sqlite file (default to /knowledgebase.sqlite3 + --editor The editor to use (default $EDITOR or vim) + --pager The pager to use (default bat or $PAGER or cat) --nogit Don't run git commands --version Output version information and exit @@ -446,6 +453,7 @@ while [[ $1 = -?* ]]; do --data) dataDir="$2"; shift ;; --sqlite) sqliteFile="$2"; shift ;; --editor) editor="$2"; shift ;; + --pager) pager="$2"; shift ;; --nogit) dogit=0 ;; --) shift; break ;; *) die "invalid option: '$1'." ;;