1{ lib, buildNpmPackage, fetchFromGitLab, installShellFiles }:
2
3buildNpmPackage rec {
4 pname = "readability-cli";
5 version = "2.4.4";
6
7 src = fetchFromGitLab {
8 owner = "gardenappl";
9 repo = pname;
10 rev = "v${version}";
11 hash = "sha256-pvAp3ZJ8/FPhrSMC8B4U1m5zuBNRP/HcsXkrW6QYgSQ=";
12 };
13
14 postPatch = ''
15 # Set a script name to avoid yargs using index.js as $0
16 substituteInPlace common.mjs \
17 --replace '.version(false)' '.version(false).scriptName("readable")'
18 '';
19
20 npmDepsHash = "sha256-X1pcgDm8C4G+hIsgx3sAVFQPadWsULvXrdLAIHnpjmE=";
21
22 nativeBuildInputs = [ installShellFiles ];
23
24 dontNpmBuild = true;
25
26 postInstall = ''
27 installManPage readability-cli.1
28 installShellCompletion --cmd readable \
29 --bash <(SHELL=bash $out/bin/readable --completion) \
30 --zsh <(SHELL=zsh $out/bin/readable --completion)
31 '';
32
33 meta = with lib; {
34 description = "Firefox Reader Mode in your terminal - get useful text from a web page using Mozilla's Readability library";
35 homepage = "https://gitlab.com/gardenappl/readability-cli";
36 license = licenses.gpl3Only;
37 maintainers = [ ];
38 mainProgram = "readable";
39 };
40}