Use standard flag package with custom help format for double-hyphen style
This commit is contained in:
parent
1c9578cb56
commit
4b9db2c242
3 changed files with 10 additions and 8 deletions
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
|
@ -12,14 +13,18 @@ import (
|
|||
"github.com/imc-vibe/backend/internal/auth"
|
||||
"github.com/imc-vibe/backend/internal/config"
|
||||
"github.com/imc-vibe/backend/internal/db"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
func main() {
|
||||
resetAdminPassword := pflag.Bool("reset-admin-password", false, "Reset admin password to a random value and exit")
|
||||
bind := pflag.StringP("bind", "b", "", "IP address to bind to (default: 0.0.0.0)")
|
||||
port := pflag.StringP("port", "p", "", "Port to listen on (default: 8080)")
|
||||
pflag.Parse()
|
||||
resetAdminPassword := flag.Bool("reset-admin-password", false, "Reset admin password to a random value and exit")
|
||||
bind := flag.String("bind", "", "IP address to bind to (default: 0.0.0.0)")
|
||||
port := flag.String("port", "", "Port to listen on (default: 8080)")
|
||||
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s [options]\n\nOptions:\n", os.Args[0])
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
flag.Parse()
|
||||
|
||||
cfg := config.Load()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue