ref: master
./main.go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
package main import ( "flag" "fmt" "os" "git.eletrotupi.com/git/dinheiro/cmd" ) const usage = `usage: dinheiro <action> [options...] server Start the server keys Generate a Fernet Key to encrypt and sign cookies/sessions help Display this message ` func init() { flag.Usage = func() { fmt.Fprintf(flag.CommandLine.Output(), usage) } } func main() { flag.Parse() switch action := flag.Arg(0); action { case "server": fmt.Println("Starting server...") cmd.Server() case "keys": cmd.GenerateKey() default: flag.Usage() if action != "help" { os.Exit(1) } } } |