Merge pull request #435 from gierens/manpage-version

Dynamic Manpage Version
This commit is contained in:
Christina Sørensen 2023-09-28 06:49:53 +02:00 committed by GitHub
commit a7a9926b53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 11 deletions

View file

@ -74,9 +74,10 @@ all-release: build-release test-release
# build the man pages
@man:
mkdir -p "${CARGO_TARGET_DIR:-target}/man"
pandoc --standalone -f markdown -t man man/eza.1.md > "${CARGO_TARGET_DIR:-target}/man/eza.1"
pandoc --standalone -f markdown -t man man/eza_colors.5.md > "${CARGO_TARGET_DIR:-target}/man/eza_colors.5"
pandoc --standalone -f markdown -t man man/eza_colors-explanation.5.md > "${CARGO_TARGET_DIR:-target}/man/eza_colors-explanation.5"
version=$(cat Cargo.toml | grep ^version | head -n 1 | awk '{print $NF}' | tr -d '"'); \
for page in eza.1 eza_colors.5 eza_colors-explanation.5; do \
pandoc --standalone -f markdown -t man <(cat "man/${page}.md" | sed "s/\$version/v${version}/g") > "${CARGO_TARGET_DIR:-target}/man/${page}"; \
done;
# build and preview the main man page (eza.1)
@man-1-preview: man

View file

@ -34,14 +34,14 @@
};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
buildInputs = with pkgs; lib.optionals stdenv.isDarwin [libiconv darwin.apple_sdk.frameworks.Security];
buildInputs = with pkgs; [zlib] ++ lib.optionals stdenv.isDarwin [libiconv darwin.apple_sdk.frameworks.Security];
in rec {
# For `nix fmt`
formatter = treefmtEval.config.build.wrapper;
packages = {
# For `nix build` `nix run`, & `nix profile install`:
default = naersk'.buildPackage {
default = naersk'.buildPackage rec {
pname = "eza";
version = "latest";
@ -50,7 +50,7 @@
# buildInputs = with pkgs; [ zlib ]
# ++ lib.optionals stdenv.isDarwin [ libiconv Security ];
buildInputs = buildInputs ++ (with pkgs; [zlib]);
inherit buildInputs;
nativeBuildInputs = with pkgs; [cmake pkg-config installShellFiles pandoc];
@ -61,9 +61,9 @@
# outputs = [ "out" "man" ];
postInstall = ''
pandoc --standalone -f markdown -t man man/eza.1.md > man/eza.1
pandoc --standalone -f markdown -t man man/eza_colors.5.md > man/eza_colors.5
pandoc --standalone -f markdown -t man man/eza_colors-explanation.5.md > man/eza_colors-explanation.5
pandoc --standalone -f markdown -t man <(cat "man/eza.1.md" | sed "s/\$version/${version}/g") > man/eza.1
pandoc --standalone -f markdown -t man <(cat "man/eza_colors.5.md" | sed "s/\$version/${version}/g") > man/eza_colors.5
pandoc --standalone -f markdown -t man <(cat "man/eza_colors-explanation.5.md" | sed "s/\$version/${version}/g")> man/eza_colors-explanation.5
installManPage man/eza.1 man/eza_colors.5 man/eza_colors-explanation.5
installShellCompletion \
--bash completions/bash/eza \

View file

@ -1,4 +1,4 @@
% eza(1) v0.9.0
% eza(1) $version
<!-- This is the eza(1) man page, written in Markdown. -->
<!-- To generate the roff version, run `just man`, -->

View file

@ -1,3 +1,9 @@
% eza_colors-explanation(5) $version
<!-- This is the eza_colors-explanation(5) man page, written in Markdown. -->
<!-- To generate the roff version, run `just man`, -->
<!-- and the man page will appear in the target directory. -->
# Name
eza_colors-explanation — more details on customizing eza colors

View file

@ -1,4 +1,4 @@
% eza_colors(5) v0.9.0
% eza_colors(5) $version
<!-- This is the eza_colors(5) man page, written in Markdown. -->
<!-- To generate the roff version, run `just man`, -->