feat: add version command

This commit is contained in:
Hintay 2025-02-03 21:56:08 +09:00
parent 4239a89d66
commit f213bdf7d6
No known key found for this signature in database
GPG key ID: 120FC7FF121F2F2D
5 changed files with 100 additions and 0 deletions

View file

@ -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 {

View file

@ -0,0 +1,7 @@
package version
var (
Version = ""
BuildId = 0
TotalBuild = 0
)