[#667] node: Add --version
flag support
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
eadc3a4de9
commit
75632a7d83
1 changed files with 18 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
@ -13,6 +14,11 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// SuccessReturnCode returns when application closed without panic
|
||||||
|
SuccessReturnCode = 0
|
||||||
|
)
|
||||||
|
|
||||||
// prints err to standard logger and calls os.Exit(1).
|
// prints err to standard logger and calls os.Exit(1).
|
||||||
func fatalOnErr(err error) {
|
func fatalOnErr(err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -29,8 +35,20 @@ func fatalOnErrDetails(details string, err error) {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
configFile := flag.String("config", "", "path to config")
|
configFile := flag.String("config", "", "path to config")
|
||||||
|
versionFlag := flag.Bool("version", false, "neofs-ir node version")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if *versionFlag {
|
||||||
|
fmt.Printf(
|
||||||
|
"Version: %s \nBuild: %s \nDebug: %s\n",
|
||||||
|
misc.Version,
|
||||||
|
misc.Build,
|
||||||
|
misc.Debug,
|
||||||
|
)
|
||||||
|
|
||||||
|
os.Exit(SuccessReturnCode)
|
||||||
|
}
|
||||||
|
|
||||||
c := initCfg(*configFile)
|
c := initCfg(*configFile)
|
||||||
|
|
||||||
initApp(c)
|
initApp(c)
|
||||||
|
|
Loading…
Reference in a new issue