mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-07-04 12:03:43 +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() {
|
func main() {
|
||||||
|
|
||||||
|
var version bool
|
||||||
var logfd *os.File
|
var logfd *os.File
|
||||||
|
|
||||||
// Command line parsing
|
// Command line parsing
|
||||||
|
getopt.FlagLong(&version, "version", 'v', "Print version")
|
||||||
getopt.FlagLong(&logFile, "log", 'l', "Path to log file", "file")
|
getopt.FlagLong(&logFile, "log", 'l', "Path to log file", "file")
|
||||||
getopt.FlagLong(&pidFile, "pid", 'p', "Path to pid file", "file")
|
getopt.FlagLong(&pidFile, "pid", 'p', "Path to pid file", "file")
|
||||||
getopt.Parse()
|
getopt.Parse()
|
||||||
|
|
||||||
|
if version {
|
||||||
|
print("Version: v1.0\n")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if len(logFile) > 0 {
|
if len(logFile) > 0 {
|
||||||
logfd = openlog(logFile)
|
logfd = openlog(logFile)
|
||||||
log.SetWriter(logfd)
|
log.SetWriter(logfd)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue