Add all of the flags
This commit is contained in:
parent
5762f27a24
commit
6e530e2fde
2
go.mod
2
go.mod
|
@ -1,3 +1,5 @@
|
|||
module git.sr.ht/~amolith/go-webring
|
||||
|
||||
go 1.17
|
||||
|
||||
require github.com/spf13/pflag v1.0.5
|
||||
|
|
2
go.sum
Normal file
2
go.sum
Normal file
|
@ -0,0 +1,2 @@
|
|||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
12
main.go
12
main.go
|
@ -5,6 +5,8 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
flag "github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
type ring struct {
|
||||
|
@ -12,7 +14,17 @@ type ring struct {
|
|||
url string
|
||||
}
|
||||
|
||||
// Pre-define all of our flags
|
||||
var (
|
||||
flagPort *int = flag.IntP("port", "p", 9285, "Port go-webring binds to")
|
||||
flagList *string = flag.StringP("list", "l", "list.txt", "Path to list of webring members")
|
||||
flagIndex *string = flag.StringP("index", "i", "index.html", "Path to home page template")
|
||||
flagCert *string = flag.StringP("cert", "c", "cert.crt", "Path to certificate")
|
||||
flagKey *string = flag.StringP("key", "k", "cert.key", "Path to private certificate key")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
list()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue