From 40b7afb35b2b1fe3ab275e6efd99b9b9b5c7ec3a Mon Sep 17 00:00:00 2001 From: Lennart Jablonka Date: Tue, 6 Sep 2022 21:50:42 +0200 Subject: [PATCH] add man page --- pay/pay.go | 8 +++----- z1.1 | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 z1.1 diff --git a/pay/pay.go b/pay/pay.go index e3ac685..63cd9ea 100644 --- a/pay/pay.go +++ b/pay/pay.go @@ -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"` diff --git a/z1.1 b/z1.1 new file mode 100644 index 0000000..d52f763 --- /dev/null +++ b/z1.1 @@ -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.