add man command to both CLIs

add man Taskfiles
This commit is contained in:
2026-03-20 19:20:29 +00:00
parent 3f6e8c4209
commit 1b9cc1f66a
10 changed files with 64 additions and 3 deletions

6
.gitignore vendored
View File

@@ -38,4 +38,8 @@ go.work.sum
# End of ignr # End of ignr
update_readme.py # Man pages
xair-cli.1
x32-cli.1
update_readme.py

17
Taskfile.man-x32.yml Normal file
View File

@@ -0,0 +1,17 @@
version: '3'
tasks:
default:
desc: View man page
cmds:
- task: view
view:
desc: View man page
cmds:
- go run ./cmd/{{.PROGRAM}} --man | man -l -
generate:
desc: Generate man page
cmds:
- go run ./cmd/{{.PROGRAM}} --man > {{.PROGRAM}}.1

17
Taskfile.man-xair.yml Normal file
View File

@@ -0,0 +1,17 @@
version: '3'
tasks:
default:
desc: View man page
cmds:
- task: view
view:
desc: View man page
cmds:
- go run ./cmd/{{.PROGRAM}} --man | man -l -
generate:
desc: Generate man page
cmds:
- go run ./cmd/{{.PROGRAM}} --man > {{.PROGRAM}}.1

View File

@@ -11,6 +11,14 @@ includes:
internal: true internal: true
vars: vars:
PROGRAM: x32-cli PROGRAM: x32-cli
man-xair:
taskfile: ./Taskfile.man-xair.yml
vars:
PROGRAM: xair-cli
man-x32:
taskfile: ./Taskfile.man-x32.yml
vars:
PROGRAM: x32-cli
vars: vars:
SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}' SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}'

View File

@@ -9,6 +9,7 @@ import (
"time" "time"
"github.com/alecthomas/kong" "github.com/alecthomas/kong"
mangokong "github.com/alecthomas/mango-kong"
"github.com/charmbracelet/log" "github.com/charmbracelet/log"
kongcompletion "github.com/jotaen/kong-completion" kongcompletion "github.com/jotaen/kong-completion"
@@ -50,7 +51,8 @@ type Config struct {
type CLI struct { type CLI struct {
Config `embed:"" prefix:"" help:"The configuration for the CLI."` Config `embed:"" prefix:"" help:"The configuration for the CLI."`
Version VersionFlag `help:"Print x32-cli version information and quit" name:"version" short:"v"` Man mangokong.ManFlag `help:"Print man page."`
Version VersionFlag `help:"Print x32-cli version information and quit" name:"version" short:"v"`
Completion kongcompletion.Completion `help:"Generate shell completion scripts." cmd:""` Completion kongcompletion.Completion `help:"Generate shell completion scripts." cmd:""`
Info InfoCmd `help:"Print mixer information." cmd:""` Info InfoCmd `help:"Print mixer information." cmd:""`

View File

@@ -9,6 +9,7 @@ import (
"time" "time"
"github.com/alecthomas/kong" "github.com/alecthomas/kong"
mangokong "github.com/alecthomas/mango-kong"
"github.com/charmbracelet/log" "github.com/charmbracelet/log"
kongcompletion "github.com/jotaen/kong-completion" kongcompletion "github.com/jotaen/kong-completion"
@@ -50,7 +51,8 @@ type Config struct {
type CLI struct { type CLI struct {
Config `embed:"" prefix:"" help:"The configuration for the CLI."` Config `embed:"" prefix:"" help:"The configuration for the CLI."`
Version VersionFlag `help:"Print xair-cli version information and quit" name:"version" short:"v"` Man mangokong.ManFlag `help:"Print man page."`
Version VersionFlag `help:"Print xair-cli version information and quit" name:"version" short:"v"`
Completion kongcompletion.Completion `help:"Generate shell completion scripts." cmd:""` Completion kongcompletion.Completion `help:"Generate shell completion scripts." cmd:""`
Info InfoCmd `help:"Print mixer information." cmd:""` Info InfoCmd `help:"Print mixer information." cmd:""`

3
go.mod
View File

@@ -4,6 +4,7 @@ go 1.25.0
require ( require (
github.com/alecthomas/kong v1.14.0 github.com/alecthomas/kong v1.14.0
github.com/alecthomas/mango-kong v0.1.0
github.com/charmbracelet/log v1.0.0 github.com/charmbracelet/log v1.0.0
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5 github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5
github.com/jotaen/kong-completion v0.0.12 github.com/jotaen/kong-completion v0.0.12
@@ -24,6 +25,8 @@ require (
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.21 // indirect github.com/mattn/go-runewidth v0.0.21 // indirect
github.com/muesli/mango v0.1.1-0.20220205060214-77e2058169ab // indirect
github.com/muesli/roff v0.1.0 // indirect
github.com/muesli/termenv v0.16.0 // indirect github.com/muesli/termenv v0.16.0 // indirect
github.com/posener/complete v1.2.3 // indirect github.com/posener/complete v1.2.3 // indirect
github.com/rivo/uniseg v0.4.7 // indirect github.com/rivo/uniseg v0.4.7 // indirect

6
go.sum
View File

@@ -2,6 +2,8 @@ github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8v
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/kong v1.14.0 h1:gFgEUZWu2ZmZ+UhyZ1bDhuutbKN1nTtJTwh19Wsn21s= github.com/alecthomas/kong v1.14.0 h1:gFgEUZWu2ZmZ+UhyZ1bDhuutbKN1nTtJTwh19Wsn21s=
github.com/alecthomas/kong v1.14.0/go.mod h1:wrlbXem1CWqUV5Vbmss5ISYhsVPkBb1Yo7YKJghju2I= github.com/alecthomas/kong v1.14.0/go.mod h1:wrlbXem1CWqUV5Vbmss5ISYhsVPkBb1Yo7YKJghju2I=
github.com/alecthomas/mango-kong v0.1.0 h1:iFVfP1k1K4qpml3JUQmD5I8MCQYfIvsD9mRdrw7jJC4=
github.com/alecthomas/mango-kong v0.1.0/go.mod h1:t+TYVdsONUolf/BwVcm+15eqcdAj15h4Qe9MMFAwwT4=
github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs= github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs=
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
@@ -47,6 +49,10 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.21 h1:jJKAZiQH+2mIinzCJIaIG9Be1+0NR+5sz/lYEEjdM8w= github.com/mattn/go-runewidth v0.0.21 h1:jJKAZiQH+2mIinzCJIaIG9Be1+0NR+5sz/lYEEjdM8w=
github.com/mattn/go-runewidth v0.0.21/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/mattn/go-runewidth v0.0.21/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/muesli/mango v0.1.1-0.20220205060214-77e2058169ab h1:m7QFONkzLK0fVXCjwX5tANcnj1yXxTnYQtnfJiY3tcA=
github.com/muesli/mango v0.1.1-0.20220205060214-77e2058169ab/go.mod h1:5XFpbC8jY5UUv89YQciiXNlbi+iJgt29VDC5xbzrLL4=
github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8=
github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig=
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

View File

@@ -9,6 +9,7 @@ Flags:
-P, --port=10023 The port of the X32 device ($X32_CLI_PORT). -P, --port=10023 The port of the X32 device ($X32_CLI_PORT).
-T, --timeout=100ms Timeout for OSC operations ($X32_CLI_TIMEOUT). -T, --timeout=100ms Timeout for OSC operations ($X32_CLI_TIMEOUT).
-L, --loglevel="warn" Log level for the CLI ($X32_CLI_LOGLEVEL). -L, --loglevel="warn" Log level for the CLI ($X32_CLI_LOGLEVEL).
--man Print man page.
-v, --version Print x32-cli version information and quit -v, --version Print x32-cli version information and quit
Commands: Commands:

View File

@@ -9,6 +9,7 @@ Flags:
-P, --port=10024 The port of the X-Air device ($XAIR_CLI_PORT). -P, --port=10024 The port of the X-Air device ($XAIR_CLI_PORT).
-T, --timeout=100ms Timeout for OSC operations ($XAIR_CLI_TIMEOUT). -T, --timeout=100ms Timeout for OSC operations ($XAIR_CLI_TIMEOUT).
-L, --loglevel="warn" Log level for the CLI ($XAIR_CLI_LOGLEVEL). -L, --loglevel="warn" Log level for the CLI ($XAIR_CLI_LOGLEVEL).
--man Print man page.
-v, --version Print xair-cli version information and quit -v, --version Print xair-cli version information and quit
Commands: Commands: