Skip to content

Commit

Permalink
README: make it possible to compile it as a manpage
Browse files Browse the repository at this point in the history
Add ifdefs for github (and ifndef for manpage) and mention that
packagers should install the manpage.
  • Loading branch information
doronbehar committed May 16, 2021
1 parent dccf132 commit 0efe241
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
/cmd/pistol/pistol
/pistol
result
pistol.1
57 changes: 55 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
ifdef::env-github[]
= Pistol
:toc:
endif::[]
ifndef::env-github[]
// If processed locally, the README will be processed as a manpage
= pistol(1)
:doctype: manpage
:manmanual: Pistol
:mansource: Pistol
:man-linkstyle: pass:[blue R < >]


== Name

pistol - General purpose file previewer designed for Ranger, Lf to make scope.sh redundant.
endif::[]

== Introduction

ifdef::env-github[]

Pistol is a file previewer for command line file managers such as
https://ranger.github.io/[Ranger], https://github.com/gokcehan/lf[Lf] and
https://github.com/jarun/nnn[nnn], intended to replace the file previewer shell
Expand All @@ -24,6 +41,14 @@ almost any archive file and for text files along with syntax
highlighting while `scope.sh` relies on external programs to do these
basic tasks.

endif::[]
ifndef::env-github[]

Pistol features native preview support for almost any archive file and text
files along with syntax highlighting.

endif::[]

The following table lists Pistol’s native previewing support:

[cols=",",options="header",]
Expand All @@ -48,9 +73,13 @@ ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpr
This feature is available out of the box just like the previews for the
common mime types mentioned above.

ifdef::env-github[]
See also the WiKi article:
https://github.com/doronbehar/pistol/wiki/Pistol-out-in-the-wild[Pistol out in
the Wild].
endif::[]

ifdef::env-github[]

=== A Note on MIME type Detection

Expand Down Expand Up @@ -103,8 +132,7 @@ https://github.com/google/brotli/issues/727[`brotli` bug report].]
If someone has packaged Pistol for your distribution, you might find a
package for of it linked
https://github.com/doronbehar/pistol/wiki/Distributions'-Packages[in
the WiKi]. If not, you can install it from source according to the
following instructions:
the WiKi]. If not, you can install it from source.

Ideally there should also be prebuilt binaries in every release's assests, but
I don't know yet how to do that - help is wanted :raising_hand:, see
Expand All @@ -131,6 +159,31 @@ footnote:[`env GO111MODULE=on` is needed due to a recent bug / issue
https://github.com/golang/go/issues/31529[with Go], see
https://github.com/doronbehar/pistol/issues/6[#6] for more details.]

Besides `libmagic`,
https://repology.org/project/asciidoctor/information[`asciidoctor`] is also
recommended, in order to compile the README as a manpage and install it. NixOS
For instance, does it like this:

[source,nix]
----
# ...
nativeBuildInputs = [
installShellFiles
asciidoctor
];
postBuild = ''
asciidoctor -b manpage -d manpage README.adoc
installManPage pistol.1
'';
# ...
----

https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/pistol/default.nix[Link
to currently evaluated file on NixOS]. Packagers for other distros should do
something similar.

endif::[]

== Usage

....
Expand Down

0 comments on commit 0efe241

Please sign in to comment.