mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-10-19 04:03:21 +02:00
nixos-help: Use xdg-open if available
This commit is contained in:
parent
f4c42695cb
commit
eefe0786f9
|
@ -21,10 +21,18 @@ let
|
|||
help = pkgs.writeScriptBin "nixos-help"
|
||||
''
|
||||
#! ${pkgs.stdenv.shell} -e
|
||||
if ! ''${BROWSER:-w3m} ${entry}; then
|
||||
echo "$0: unable to start a web browser; please set \$BROWSER or install ‘w3m’"
|
||||
browser="$BROWSER"
|
||||
if [ -z "$browser" ]; then
|
||||
browser="$(type -P xdg-open || true)"
|
||||
if [ -z "$browser" ]; then
|
||||
browser="$(type -P w3m || true)"
|
||||
if [ -z "$browser" ]; then
|
||||
echo "$0: unable to start a web browser; please set \$BROWSER"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
exec "$browser" ${entry}
|
||||
'';
|
||||
|
||||
in
|
||||
|
|
Loading…
Reference in a new issue