From e5f8df45b4e608f9f5a404862392c58adbbda9f0 Mon Sep 17 00:00:00 2001 From: Dylan Lom Date: Sun, 6 Dec 2020 15:11:18 +1100 Subject: [PATCH] Add manpages for stopwatch, suptime and timestamp --- Makefile | 44 +++++++++++++++++++++++++----------------- src/stopwatch.1 | 9 +++++++++ src/suptime.1 | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ src/timestamp.1 | 34 +++++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 17 deletions(-) create mode 100644 src/stopwatch.1 create mode 100644 src/suptime.1 create mode 100644 src/timestamp.1 diff --git a/Makefile b/Makefile index ab7b3d7..05bbf89 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,45 @@ +SRCDIR = src +DISTDIR = dist +DISTBIN = $(DISTDIR)/usr/bin +DISTMAN = $(DISTDIR)/usr/share/man + all: djl-utils.deb dist: bin DEBIAN.control bin: line sign pasta suptime countdown stopwatch timestamp distdir: - mkdir -p dist/usr/bin + mkdir -p $(DISTBIN) + mkdir -p $(DISTMAN)/man1 -line: src/line.c distdir - cc -o dist/usr/bin/line src/line.c +line: $(SRCDIR)/line.c distdir + cc -o $(DISTBIN)/line $(SRCDIR)/line.c -sign: src/sign distdir - cp src/sign dist/usr/bin +sign: $(SRCDIR)/sign distdir + cp $(SRCDIR)/sign $(DISTBIN)/sign -pasta: src/pasta distdir - cp src/pasta dist/usr/bin +pasta: $(SRCDIR)/pasta distdir + cp $(SRCDIR)/pasta $(DISTBIN)/pasta -suptime: src/suptime.c distdir - cc -o dist/usr/bin/suptime src/suptime.c +suptime: $(SRCDIR)/suptime.c $(SRCDIR)/suptime.1 distdir + cc -o $(DISTBIN)/suptime $(SRCDIR)/suptime.c + cp $(SRCDIR)/suptime.1 $(DISTMAN)/man1/suptime.1 -countdown: src/countdown.c distdir - cc -o dist/usr/bin/countdown src/countdown.c +countdown: $(SRCDIR)/countdown.c distdir + cc -o $(DISTBIN)/countdown $(SRCDIR)/countdown.c -stopwatch: src/stopwatch.c distdir - cc -o dist/usr/bin/stopwatch src/stopwatch.c +stopwatch: $(SRCDIR)/stopwatch.c $(SRCDIR)/stopwatch.1 distdir + cc -o $(DISTBIN)/stopwatch $(SRCDIR)/stopwatch.c + cp $(SRCDIR)/stopwatch.1 $(DISTMAN)/man1/stopwatch.1 -timestamp: src/timestamp distdir - cp src/timestamp dist/usr/bin +timestamp: $(SRCDIR)/timestamp $(SRCDIR)/timestamp.1 distdir + cp $(SRCDIR)/timestamp $(DISTBIN) + cp $(SRCDIR)/timestamp.1 $(DISTMAN)/man1/timestamp.1 -DEBIAN.control: src/DEBIAN/control distdir + +DEBIAN.control: $(SRCDIR)/DEBIAN/control distdir rm -rf dist/DEBIAN - cp -r src/DEBIAN dist/DEBIAN + cp -r $(SRCDIR)/DEBIAN dist/DEBIAN djl-utils.deb: dist dpkg-deb -b dist diff --git a/src/stopwatch.1 b/src/stopwatch.1 new file mode 100644 index 0000000..985f449 --- /dev/null +++ b/src/stopwatch.1 @@ -0,0 +1,9 @@ +.TH STOPWATCH 1 +.SH NAME +stopwatch \- start a stopwatch +.SH SYNOPSIS +.B stopwatch +.SH DESCRIPTION +.B stopwatch +starts a stopwatch, counting up once every second. +To stop the stopwatch, press any key. diff --git a/src/suptime.1 b/src/suptime.1 new file mode 100644 index 0000000..9a66764 --- /dev/null +++ b/src/suptime.1 @@ -0,0 +1,51 @@ +.TH SUPTIME 1 + +.SH NAME +suptime \- Tell how long the system has been running. +.SH SYNOPSIS +.B suptime +[\fB\-s\fR] +[\fB\-m\fR] +[\fB\-H\fR] +[\fB\-d\fR] +[\fB\-h\fR] +.SH DESCRIPTION +.B suptime +outputs a single unit representation of system uptime. +By default outputs in seconds. +If multiple arguments are given, the last unit will be used. +.SH OPTIONS +.TP +.BR \-s +Output in seconds. +.TP +.BR \-m +Output in minutes. +.TP +.BR \-H +Output in hours. +.TP +.BR \-d +Output in days. +.TP +.BR \-h +Display help. +.SH EXAMPLES +To output system uptime in seconds +.PP +.nf +.RS +suptime +.RE +.fi +.PP +You can also include use the \fB\-s\fR option although it is not necessary to +output seconds. +.PP +To output system uptime in days +.PP +.nf +.RS +suptime -d +.RE +.fi diff --git a/src/timestamp.1 b/src/timestamp.1 new file mode 100644 index 0000000..40b44cb --- /dev/null +++ b/src/timestamp.1 @@ -0,0 +1,34 @@ +.TH TIMESTAMP 1 +.SH NAME +timestamp \- print the current datetime +.SH SYNOPSIS +.B timestamp +[\fB\-d\fR] +[\fB\-r\fR] +[\fB\-v\fR] +[\fB\-h\fR] +.SH DESCRIPTION +.B timestamp +prints the current datetime. +.SH OPTIONS +.TP +.BR \-d +Use %Y-%m-%d format. +.TP +.BR \-r +Use the RFC3339 timestamp format. +.TP +.BR \-v +Use %Y-%m-%d %T %Z format. +This is the default format if none are given. +.TP +.BR \-h +Display help +.SH EXAMPLES +To get the current datetime in RFC3339 format +.PP +.nf +.RS +timestamp -r +.RE +.fi