tested version flag and subcmd on exec and pidproxy; some clean up

This commit is contained in:
Suyono 2024-09-19 17:34:56 +10:00
parent dc6d575fae
commit fe31698724
8 changed files with 14 additions and 12 deletions

5
.gitignore vendored
View File

@ -1,3 +1,6 @@
/cmd/wingmate/wingmate
/cmd/wingmate/version.txt
/cmd/pidproxy/pidproxy
/cmd/exec/exec
/cmd/pidproxy/version.txt
/cmd/exec/exec
/cmd/exec/version.txt

View File

@ -34,7 +34,7 @@ func (v Version) Flag(cmd *cobra.Command) {
}
func (v Version) FlagHook() {
if viper.GetInt(versionFlag) > 0 {
if viper.GetBool(versionFlag) {
v.Print()
}
}

View File

@ -4,16 +4,17 @@ import (
_ "embed"
"errors"
"fmt"
"gitea.suyono.dev/suyono/wingmate"
"gitea.suyono.dev/suyono/wingmate/cmd/cli"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"golang.org/x/sys/unix"
"log"
"os"
"os/exec"
"strconv"
"strings"
"gitea.suyono.dev/suyono/wingmate"
"gitea.suyono.dev/suyono/wingmate/cmd/cli"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"golang.org/x/sys/unix"
)
type execApp struct {
@ -61,6 +62,7 @@ func main() {
_ = viper.BindPFlag(EnvUser, rootCmd.PersistentFlags().Lookup(userFlag))
app.version.Flag(rootCmd)
app.version.Cmd(rootCmd)
viper.SetEnvPrefix(wingmate.EnvPrefix)
_ = viper.BindEnv(EnvUser)

View File

@ -1 +0,0 @@
dev

View File

@ -6,4 +6,5 @@
/oneshot/version.txt
/spawner/spawner
/spawner/version.txt
/bg/bg
/bg/bg
/bg/version.txt

View File

@ -1 +0,0 @@
dev

View File

@ -1 +0,0 @@
dev

View File

@ -1 +0,0 @@
dev