diff options
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/lesspipe')
-rw-r--r-- | nixpkgs/pkgs/tools/misc/lesspipe/default.nix | 43 | ||||
-rw-r--r-- | nixpkgs/pkgs/tools/misc/lesspipe/fix-paths.patch | 22 |
2 files changed, 65 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/misc/lesspipe/default.nix b/nixpkgs/pkgs/tools/misc/lesspipe/default.nix new file mode 100644 index 000000000000..bb99521cc27e --- /dev/null +++ b/nixpkgs/pkgs/tools/misc/lesspipe/default.nix @@ -0,0 +1,43 @@ +{ stdenv, fetchFromGitHub, substituteAll, perl, file, ncurses }: + +stdenv.mkDerivation rec { + pname = "lesspipe"; + version = "1.84"; + + buildInputs = [ perl ]; + preConfigure = "patchShebangs ."; + + src = fetchFromGitHub { + owner = "wofr06"; + repo = "lesspipe"; + rev = version; + sha256 = "124ffhzrikr88ab14rk6753n8adxijpmg7q3zx7nmqc52wpkfd8q"; + }; + + patches = [ + (substituteAll { + src = ./fix-paths.patch; + file = "${file}/bin/file"; + tput = "${ncurses}/bin/tput"; + }) + ]; + + meta = with stdenv.lib; { + description = "A preprocessor for less"; + longDescription = '' + Usually lesspipe.sh is called as an input filter to less. With the help + of that filter less will display the uncompressed contents of compressed + (gzip, bzip2, compress, rar, 7-zip, lzip, xz or lzma) files. For files + containing archives and directories, a table of contents will be + displayed (e.g tar, ar, rar, jar, rpm and deb formats). Other supported + formats include nroff, pdf, ps, dvi, shared library, MS word, OASIS + (e.g. Openoffice), NetCDF, html, mp3, jpg, png, iso images, MacOSX bom, + plist and archive formats, perl storable data and gpg encrypted files. + This does require additional helper programs being installed. + ''; + homepage = https://github.com/wofr06/lesspipe; + platforms = platforms.all; + license = licenses.gpl2; + maintainers = [ maintainers.martijnvermaat ]; + }; +} diff --git a/nixpkgs/pkgs/tools/misc/lesspipe/fix-paths.patch b/nixpkgs/pkgs/tools/misc/lesspipe/fix-paths.patch new file mode 100644 index 000000000000..1bffcf53c827 --- /dev/null +++ b/nixpkgs/pkgs/tools/misc/lesspipe/fix-paths.patch @@ -0,0 +1,22 @@ +--- a/lesspipe.sh.in ++++ b/lesspipe.sh.in +@@ -48,8 +48,8 @@ if [[ "$LESS_ADVANCED_PREPROCESSOR" = '' ]]; then + fi + + filecmd() { +- file -L -s "$@" +- file -L -s -i "$@" 2> /dev/null | sed -n 's/.*charset=/;/p' | tr a-z A-Z ++ @file@ -L -s "$@" ++ @file@ -L -s -i "$@" 2> /dev/null | sed -n 's/.*charset=/;/p' | tr a-z A-Z + } + + sep=: # file name separator +@@ -546,7 +546,7 @@ isfinal() { + + # color requires -r or -R when calling less + typeset COLOR +- if [[ $(tput colors) -ge 8 && ("$LESS" = *-*r* || "$LESS" = *-*R*) ]]; then ++ if [[ $(@tput@ colors) -ge 8 && ("$LESS" = *-*r* || "$LESS" = *-*R*) ]]; then + COLOR="--color=always" + fi + |