mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
feat: add version command
This commit is contained in:
parent
4239a89d66
commit
f213bdf7d6
5 changed files with 100 additions and 0 deletions
|
@ -2,9 +2,11 @@ package cmd
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/0xJacky/Nginx-UI/internal/version"
|
||||
"github.com/urfave/cli/v3"
|
||||
)
|
||||
|
||||
|
@ -32,6 +34,11 @@ func NewAppCmd() *cli.Command {
|
|||
},
|
||||
},
|
||||
DefaultCommand: "serve",
|
||||
Version: version.Version,
|
||||
}
|
||||
|
||||
cli.VersionPrinter = func(cmd *cli.Command) {
|
||||
fmt.Printf("%s (%d)\n", cmd.Root().Version, version.BuildId)
|
||||
}
|
||||
|
||||
if err := cmd.Run(context.Background(), os.Args); err != nil {
|
||||
|
|
7
internal/version/version.go
Normal file
7
internal/version/version.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package version
|
||||
|
||||
var (
|
||||
Version = ""
|
||||
BuildId = 0
|
||||
TotalBuild = 0
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue