]> git.proxmox.com Git - proxmox-mini-journalreader.git/commitdiff
add manual page backed by scdoc
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 17 May 2023 17:02:51 +0000 (19:02 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 17 May 2023 17:29:50 +0000 (19:29 +0200)
scdoc is simple enough and being markdown based also easy to write
and maintain, additionally it has no dependencies besides the
standard libc, so quite a good fit for a minimal project like
proxmox-mini-journalreader.

https://drewdevault.com/2018/05/13/scdoc.html
https://git.sr.ht/~sircmpwn/scdoc

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
debian/control
src/Makefile
src/mini-journalreader.scd [new file with mode: 0644]

index 4357c7d1f6fd2b7f4a3abe286f59474e68f2c566..8280f6ddd331e83226a86e888b1350d6cfc9becd 100644 (file)
@@ -2,12 +2,12 @@ Source: proxmox-mini-journalreader
 Section: admin
 Priority: optional
 Maintainer: Proxmox Support Team <support@proxmox.com>
-Build-Depends: debhelper-compat (= 13), libsystemd-dev, pkg-config
+Build-Depends: debhelper-compat (= 13), libsystemd-dev, pkg-config, scdoc,
 Standards-Version: 4.6.2
 
 Package: proxmox-mini-journalreader
 Architecture: any
-Depends: ${misc:Depends}, ${shlibs:Depends}
+Depends: ${misc:Depends}, ${shlibs:Depends},
 Description: Minimal systemd Journal Reader
  A minimal application to read the last X lines of the systemd journal or the
  last X lines before a cursor.
index 8dfe1c40e0df251b164fb21cea85cc2752b0696d..1ef0974598dd685084aac3287851e3f0937743b6 100644 (file)
@@ -2,6 +2,7 @@ PROGRAM=mini-journalreader
 SOURCES=mini-journalreader.c
 
 BIN_DIR ?= $(DESTDIR)/usr/bin
+MAN1_DIR ?= $(DESTDIR)/usr/share/man/man1
 
 LIBS := libsystemd
 CFLAGS += -Werror -Wall -Wextra -Wl,-z,relro -g -O2
@@ -15,13 +16,18 @@ $(PROGRAM): $(SOURCES)
        gcc $< -o $@ $(CFLAGS) $(LDFLAGS)
 
 .PHONY: install
-install: $(PROGRAM) proxmox-mini-journalreader.1
+install: $(PROGRAM) mini-journalreader.1
        install -d -m 0755 $(BIN_DIR)
        install -m 0755 $(PROGRAM) $(BIN_DIR)
+       install -d -m 0755 $(MAN1_DIR)
+       install -m 0644 mini-journalreader.1 $(MAN1_DIR)
+
+mini-journalreader.1: mini-journalreader.scd
+       scdoc < $< > $@
 
 .PHONY: distclean
 distclean: clean
 
 .PHONY: clean
 clean:
-       rm -rf $(PROGRAM)
+       rm -rf $(PROGRAM) mini-journalreader.1
diff --git a/src/mini-journalreader.scd b/src/mini-journalreader.scd
new file mode 100644 (file)
index 0000000..63bfee3
--- /dev/null
@@ -0,0 +1,45 @@
+proxmox-mini-journalreader(1)
+
+# NAME
+proxmox-mini-journalreader - read systemd journald logs
+
+# SYNOPSIS
+*proxmox-mini-journalreader* [OPTIONS]
+
+# DESCRIPTION
+Provides access to systemd journald logs, allowing users to fetch log entries
+based on timestamps, cursors, or a specified number of last entries.
+
+# OPTIONS
+*-b* <timestamp>
+       Begin at this UNIX epoch timestamp.
+
+*-e* <timestamp>
+       End at this UNIX epoch timestamp.
+
+*-d* <directory>
+       Specify a custom journal directory.
+
+*-n* <integer>
+       Print the last number of entries logged.
+
+*-f* <cursor>
+       Print starting from this cursor.
+
+*-t* <cursor>
+       Print until (to) this cursor.
+
+*-h*
+       Display the help message.
+
+# NOTES
+. No range option means dump all entries.
+. Range conflicts with -n.
+. -b and -f conflict.
+. -e and -t conflict.
+
+# SEE ALSO
+journalctl(1), systemd-journald.service(8)
+
+# AUTHORS
+The Proxmox Support Team <support@proxmox.com>.