File: pager.sh

package info (click to toggle)
clifm 1.26.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,816 kB
  • sloc: ansic: 64,595; sh: 3,133; python: 1,851; makefile: 567
file content (31 lines) | stat: -rwxr-xr-x 824 bytes parent folder | download
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
27
28
29
30
31
#!/bin/sh

# Description: Print the current list of files through a pager (less)
# Dependencies: less, tput
# Author: L. Abramovich
# License: GPL2+

if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
	name="${CLIFM_PLUGIN_NAME:-$(basename "$0")}"
	printf "List the current list of files through a pager (less)\n"
	printf "\n\x1b[1mUSAGE\x1b[0m\n  %s\n" "$name"
	exit 0
fi

if ! type less >/dev/null 2>&1; then
	printf "clifm: less: command not found\n" >&2
	exit 127
fi

if ! type tput >/dev/null 2>&1; then
	printf "clifm: tput: command not found\n" >&2
	exit 127
fi

clifm_opts="--ls --no-clear-screen"
[ "$CLIFM_LONG_VIEW" = "1" ] && clifm_opts="${clifm_opts} -l"

# shellcheck disable=SC2086
CLIFM_COLUMNS="$(tput cols)" CLIFM_LINES="$(tput lines)" clifm $clifm_opts "$PWD" | less -rncs -P"LESS (clifm)\:" --tilde

exit 0