Browse code

Add `webman`

Robert Cranston authored on 24/11/2025 22:10:51
Showing 2 changed files

... ...
@@ -39,3 +39,32 @@ webvulkan()
39 39
 {
40 40
   websearch "https://docs.vulkan.org/refpages/" "$@"
41 41
 }
42
+
43
+# TODO: The `man -` makes this require two ^Z presses to background.
44
+webman()
45
+(
46
+  # See also <https://wiki.archlinux.org/title/Man_page#Online_man_pages>.
47
+  # websearch "https://man7.org/linux/man-pages/" "$1${sect+.$sect}"
48
+  # xdg-open "https://man.archlinux.org/search?go=Go&q=$1${sect+.$sect}"
49
+  # xdg-open "https://manpages.debian.org/$1${sect+.$sect}"
50
+  # xdg-open "https://man.cx/$1${sect+($sect)}"
51
+  # xdg-open "https://man.he.net/?section=${sect-all}&topic=$1"
52
+
53
+  # See <https://man.archlinux.org/#USAGE>.
54
+  # curl -sfL "https://man.archlinux.org/man/$1.raw" | man -l -
55
+  # curl -sfL "https://man.archlinux.org/man/$1.txt" | less
56
+
57
+  # See <https://manpages.debian.org/>.
58
+  # curl -sfL "https://manpages.debian.org/$1.gz" | man -l -
59
+
60
+  [ "$2" ] && sect="$1" && shift || true
61
+  for url in \
62
+    "https://man.archlinux.org/man/$1${sect+.$sect}.raw" \
63
+    "https://manpages.debian.org/$1${sect+.$sect}.gz"
64
+  do
65
+    page="$(curl -sfL "$url")"
66
+    [ "$page" ] || continue
67
+    printf '%s\n' "$page" | man -l -
68
+    break
69
+  done
70
+)
... ...
@@ -12,6 +12,7 @@ Provided shell functions:
12 12
 -   `webwin32 <terms>`: Native C/C++ [Windows API][] (also 64-bit).
13 13
 -   `webopengl <terms>`: [OpenGL][] refpages.
14 14
 -   `webvulkan <terms>`: [Vulkan][] refpages.
15
+-   `webman [<section>] <page>`: [Arch][]/[Debian][] [man page][]s in [pager][].
15 16
 
16 17
 [`dotfiles-websearch`]: https://git.rcrnstn.net/rcrnstn/dotfiles-websearch
17 18
 [dotfile]: https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory#Unix_and_Unix-like_environments
... ...
@@ -24,6 +25,9 @@ Provided shell functions:
24 25
 [Windows API]: https://en.wikipedia.org/wiki/Windows_API#Major_versions
25 26
 [OpenGL]: https://en.wikipedia.org/wiki/OpenGL
26 27
 [Vulkan]: https://en.wikipedia.org/wiki/Vulkan
28
+[Arch]: https://en.wikipedia.org/wiki/Arch_Linux
29
+[man page]: https://en.wikipedia.org/wiki/Man_page
30
+[pager]: https://en.wikipedia.org/wiki/Terminal_pager
27 31
 
28 32
 ## License
29 33