Add manpages for stopwatch, suptime and timestamp

This commit is contained in:
Dylan Lom 2020-12-06 15:11:18 +11:00
parent cce6188649
commit e5f8df45b4
4 changed files with 121 additions and 17 deletions

View File

@ -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

9
src/stopwatch.1 Normal file
View File

@ -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.

51
src/suptime.1 Normal file
View File

@ -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

34
src/timestamp.1 Normal file
View File

@ -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