Merge pull request #287785 from chewblacka/fix-docfd

docfd: add fzf support
This commit is contained in:
Nick Cao 2024-02-11 13:06:46 -05:00 committed by GitHub
commit 4a97fef877
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
{ lib, ocamlPackages, fetchFromGitHub, python3, dune_3, makeWrapper, poppler_utils }:
{ lib, ocamlPackages, fetchFromGitHub, python3, dune_3, makeWrapper, poppler_utils, fzf }:
ocamlPackages.buildDunePackage rec {
pname = "docfd";
@ -14,26 +14,23 @@ ocamlPackages.buildDunePackage rec {
};
nativeBuildInputs = [ python3 dune_3 makeWrapper ];
buildInputs = [ poppler_utils ] ++
(with ocamlPackages; [ oseq spelll notty nottui lwd cmdliner domainslib digestif yojson eio_main containers-data timedesc ]);
buildInputs = with ocamlPackages; [ oseq spelll notty nottui lwd cmdliner domainslib digestif yojson eio_main containers-data timedesc ];
postInstall = ''
# docfd needs pdftotext from popler_utils to allow pdf search
wrapProgram $out/bin/docfd --prefix PATH : "${lib.getBin poppler_utils}/bin/"
# also fzf for "docfd ?" usage
wrapProgram $out/bin/docfd --prefix PATH : "${lib.makeBinPath [ poppler_utils fzf ]}"
'';
meta = with lib; {
description = "TUI multiline fuzzy document finder";
longDescription = ''
Interactive grep, but word/token/phrase based rather than regex
and line based, so you can search across multiple lines (simlar to
Recoll but TUI).
Aims to provide a good UX via text editor and PDF viewer integration.
When opening a text file, Docfd opens file at first line of search
result. If PDF, then Docfd opens file at first page of the search
result and starts a text search of the most unique word of the matched
phrase within the same page.
Main intended use case: navigating directories of notes and PDFs.
TUI multiline fuzzy document finder.
Think interactive grep for both text files and PDFs, but word/token based
instead of regex and line based, so you can search across lines easily.
Docfd aims to provide good UX via integration with common text editors
and PDF viewers, so you can jump directly to a search result with a
single key press.
'';
homepage = "https://github.com/darrenldl/docfd";
license = licenses.mit;