add version flag
This commit is contained in:
parent
a110d5768f
commit
5ef58cadee
16
cmd/root.go
16
cmd/root.go
|
@ -3,15 +3,16 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/apex/log"
|
|
||||||
"github.com/mitchellh/colorstring"
|
|
||||||
"github.com/pterodactyl/wings/loggers/cli"
|
|
||||||
"golang.org/x/crypto/acme/autocert"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/apex/log"
|
||||||
|
"github.com/mitchellh/colorstring"
|
||||||
|
"github.com/pterodactyl/wings/loggers/cli"
|
||||||
|
"golang.org/x/crypto/acme/autocert"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/pkg/profile"
|
"github.com/pkg/profile"
|
||||||
"github.com/pterodactyl/wings/config"
|
"github.com/pterodactyl/wings/config"
|
||||||
|
@ -30,6 +31,7 @@ var debug = false
|
||||||
var shouldRunProfiler = false
|
var shouldRunProfiler = false
|
||||||
var useAutomaticTls = false
|
var useAutomaticTls = false
|
||||||
var tlsHostname = ""
|
var tlsHostname = ""
|
||||||
|
var showVersion = false
|
||||||
|
|
||||||
var root = &cobra.Command{
|
var root = &cobra.Command{
|
||||||
Use: "wings",
|
Use: "wings",
|
||||||
|
@ -45,6 +47,7 @@ var root = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
root.PersistentFlags().BoolVar(&showVersion, "version", false, "show the version and exit")
|
||||||
root.PersistentFlags().StringVar(&configPath, "config", config.DefaultLocation, "set the location for the configuration file")
|
root.PersistentFlags().StringVar(&configPath, "config", config.DefaultLocation, "set the location for the configuration file")
|
||||||
root.PersistentFlags().BoolVar(&debug, "debug", false, "pass in order to run wings in debug mode")
|
root.PersistentFlags().BoolVar(&debug, "debug", false, "pass in order to run wings in debug mode")
|
||||||
root.PersistentFlags().BoolVar(&shouldRunProfiler, "profile", false, "pass in order to profile wings")
|
root.PersistentFlags().BoolVar(&shouldRunProfiler, "profile", false, "pass in order to profile wings")
|
||||||
|
@ -76,6 +79,11 @@ func readConfiguration() (*config.Configuration, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func rootCmdRun(*cobra.Command, []string) {
|
func rootCmdRun(*cobra.Command, []string) {
|
||||||
|
if showVersion {
|
||||||
|
fmt.Println(system.Version)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
if shouldRunProfiler {
|
if shouldRunProfiler {
|
||||||
defer profile.Start().Stop()
|
defer profile.Start().Stop()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user