Add cmd for generating code from the new models
Some checks are pending
/ test (push) Waiting to run
Some checks are pending
/ test (push) Waiting to run
This commit is contained in:
parent
67b507f4bd
commit
bf5180559f
9 changed files with 401 additions and 132 deletions
48
shared/flags.go
Normal file
48
shared/flags.go
Normal file
|
@ -0,0 +1,48 @@
|
|||
package shared
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
var (
|
||||
FlagConfigFile *string = flag.String(
|
||||
"config",
|
||||
"config.toml",
|
||||
"Location of the config file",
|
||||
)
|
||||
FlagConfigOnly *bool = flag.Bool(
|
||||
"validate-config",
|
||||
false,
|
||||
"If set, the server will only validate the config (or write the default one) and then quit",
|
||||
)
|
||||
)
|
||||
|
||||
func flagUsage() {
|
||||
executable, err := os.Executable()
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to get own path")
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "Usage of %s:\n", executable)
|
||||
fmt.Fprintln(os.Stderr, "\t-config string")
|
||||
fmt.Fprintln(os.Stderr, "\t\tLocation of the config file (default: \"config.toml\")")
|
||||
fmt.Fprintln(os.Stderr, "\t-loglevel string")
|
||||
fmt.Fprintln(
|
||||
os.Stderr,
|
||||
"\t\tSet the logging level. Options are: Trace, Debug, Info, Warning, Error and Fatal. Case insensitive (default: \"Info\")",
|
||||
)
|
||||
fmt.Fprintln(os.Stderr, "\t-validate-config")
|
||||
fmt.Fprintln(
|
||||
os.Stderr,
|
||||
"\t\tIf set, the server will only validate the config (or write the default one) and then quit",
|
||||
)
|
||||
fmt.Fprintln(os.Stderr, "\t-jsonlogs")
|
||||
fmt.Fprintln(os.Stderr, "\t\tIf set, writes logging messages as json objects instead")
|
||||
}
|
||||
|
||||
func init() {
|
||||
flag.Usage = flagUsage
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue