add man page

This commit is contained in:
Lennart Jablonka 2022-09-06 21:50:42 +02:00
parent d8984df882
commit 40b7afb35b
2 changed files with 32 additions and 5 deletions

View File

@ -13,16 +13,15 @@ import (
)
func usage() {
fmt.Fprintf(os.Stderr, "usage: %s pay [-h host] [-a user:password] user amount\n", os.Args[0])
fmt.Fprintf(os.Stderr, "usage: %s pay [-h host] user amount\n", os.Args[0])
os.Exit(1)
}
func Main(args []string) {
host := "https://usualsuspect:freundschaft@kasse.z1.ccchb.de"
// auth := "usualsuspect:freundschaft"
getopt.Usage = usage
opts, optind, err := getopt.Getopts(args, "h:a:")
opts, optind, err := getopt.Getopts(args, "h:")
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
@ -31,8 +30,6 @@ func Main(args []string) {
switch opt.Option {
case 'h':
host = opt.Value
case 'a':
// auth = opt.Value
}
}
@ -46,6 +43,7 @@ func Main(args []string) {
fmt.Fprintf(os.Stderr, "%s: amount: %v\n", os.Args[0], err)
os.Exit(1)
}
amount = -amount
req := struct {
Amount int `json:"amount"`

29
z1.1 Normal file
View File

@ -0,0 +1,29 @@
.Dd September 6, 2022
.Dt Z1 1
.Os
.Sh NAME
.Nm z1
.Nd utility for interacting with the Z1
.Sh SYNOPSIS
.Nm
.Cm pay
.Op Fl h Ar host
.Ar user
.Ar amount
.Sh DESCRIPTION
.Nm
provides an interface with the Zweigstelle 1.
.Ss Pay
.Cm pay
lets you pay for drinks via the Strichliste.
The amount of money to pay is specified as Euro-cents in
.Ar amount .
If
.Ar amount
is negative, its absolute value is deposited.
The hostname of the Strichliste can be overridden with option
.Fl h ;
the default is
.Lk https://usualsuspect:freundschaft@kasse.z1.ccchb.de .
.Sh BUGS
The user needs to be specified as numeric ID.