mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 18:31:35 +00:00
docs: refactor
This commit is contained in:
parent
a35eab716a
commit
e360a1c16c
38 changed files with 829 additions and 789 deletions
43
docs/html-open-tool.nix
Normal file
43
docs/html-open-tool.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
writeShellScriptBin,
|
||||
makeDesktopItem,
|
||||
symlinkJoin,
|
||||
}: {
|
||||
html,
|
||||
pathName ? "neovim-flake",
|
||||
projectName ? pathName,
|
||||
name ? "${pathName}-help",
|
||||
}: let
|
||||
helpScript = writeShellScriptBin name ''
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ! -v BROWSER || -z $BROWSER ]]; then
|
||||
for candidate in xdg-open open w3m; do
|
||||
BROWSER="$(type -P $candidate || true)"
|
||||
if [[ -x $BROWSER ]]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ ! -v BROWSER || -z $BROWSER ]]; then
|
||||
echo "$0: unable to start a web browser; please set \$BROWSER"
|
||||
exit 1
|
||||
else
|
||||
exec "$BROWSER" "${html}/share/doc/${pathName}/index.xhtml"
|
||||
fi
|
||||
'';
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = "${pathName}-manual";
|
||||
desktopName = "${projectName} Manual";
|
||||
genericName = "View ${projectName} documentation in a web browser";
|
||||
icon = "nix-snowflake";
|
||||
exec = "${helpScript}/bin/${name}";
|
||||
categories = ["System"];
|
||||
};
|
||||
in
|
||||
symlinkJoin {
|
||||
inherit name;
|
||||
paths = [helpScript desktopItem];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue