diff --git a/README.md b/README.md index 089ded8..67113ee 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,16 @@ go install github.com/onyx-and-iris/gobs-cli@latest #### Flags -Pass `--host`, `--port` and `--password` as flags to the root command, for example: +- --host/-H: Websocket host +- --port/-P Websocket port +- --password/-p: Websocket password +- --timeout/-T: Websocket timeout +- --version/-v: Print the gobs-cli version + +Pass `--host`, `--port` and `--password` as flags on the root command, for example: ```console -gobs-cli --host=localhost --port=4455 --password= --help +gobs-cli --host localhost --port 4455 --password 'websocket password' --help ``` #### Environment Variables @@ -37,14 +43,6 @@ OBS_TIMEOUT=5 ## Commands -### VersionFlag - -- --version/-v: Print gobs-cli version information and quit - -```console -gobs-cli --version -``` - ### ObsVersionCmd - Print OBS client and websocket version. diff --git a/main.go b/main.go index 298e794..e970a91 100644 --- a/main.go +++ b/main.go @@ -18,10 +18,10 @@ import ( // ObsConfig holds the configuration for connecting to the OBS WebSocket server. type ObsConfig struct { - Host string `flag:"host" help:"Host to connect to." default:"localhost" env:"OBS_HOST"` - Port int `flag:"port" help:"Port to connect to." default:"4455" env:"OBS_PORT"` - Password string `flag:"password" help:"Password for authentication." default:"" env:"OBS_PASSWORD"` - Timeout int `flag:"timeout" help:"Timeout in seconds." default:"5" env:"OBS_TIMEOUT"` + Host string `flag:"host" help:"Host to connect to." default:"localhost" env:"OBS_HOST" short:"H"` + Port int `flag:"port" help:"Port to connect to." default:"4455" env:"OBS_PORT" short:"P"` + Password string `flag:"password" help:"Password for authentication." default:"" env:"OBS_PASSWORD" short:"p"` + Timeout int `flag:"timeout" help:"Timeout in seconds." default:"5" env:"OBS_TIMEOUT" short:"T"` } // CLI is the main command line interface structure. diff --git a/version.go b/version.go index 23deeb0..edc7ac8 100644 --- a/version.go +++ b/version.go @@ -18,8 +18,8 @@ func (v VersionFlag) Decode(_ *kong.DecodeContext) error { return nil } func (v VersionFlag) IsBool() bool { return true } // BeforeApply implements the kong.Flag interface for VersionFlag. -func (v VersionFlag) BeforeApply(app *kong.Kong, _ kong.Vars) error { - fmt.Println(version) +func (v VersionFlag) BeforeApply(app *kong.Kong, _ kong.Vars) error { // nolint: unparam + fmt.Printf("gobs-cli version: %s\n", version) app.Exit(0) // Exit the application after printing the version return nil }