mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-19 05:10:02 +02:00
src/main.go: add -v and --version flag.
This commit is contained in:
parent
de78a7c622
commit
15a4566b3b
1 changed files with 7 additions and 0 deletions
|
|
@ -51,13 +51,20 @@ func openlog(file string) *os.File {
|
|||
// ---------------------------------------------------------
|
||||
func main() {
|
||||
|
||||
var version bool
|
||||
var logfd *os.File
|
||||
|
||||
// Command line parsing
|
||||
getopt.FlagLong(&version, "version", 'v', "Print version")
|
||||
getopt.FlagLong(&logFile, "log", 'l', "Path to log file", "file")
|
||||
getopt.FlagLong(&pidFile, "pid", 'p', "Path to pid file", "file")
|
||||
getopt.Parse()
|
||||
|
||||
if version {
|
||||
print("Version: v1.0\n")
|
||||
return;
|
||||
}
|
||||
|
||||
if len(logFile) > 0 {
|
||||
logfd = openlog(logFile)
|
||||
log.SetWriter(logfd)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue