reorganise command fields

This commit is contained in:
onyx-and-iris 2026-01-31 22:26:31 +00:00
parent e7dd589243
commit 2730f8dc5d
3 changed files with 57 additions and 86 deletions

View File

@ -8,9 +8,9 @@ import (
// busCmd represents the bus command. // busCmd represents the bus command.
var busCmd = &cobra.Command{ var busCmd = &cobra.Command{
Use: "bus",
Short: "Commands to control individual buses", Short: "Commands to control individual buses",
Long: `Commands to control individual buses of the XAir mixer, including mute status.`, Long: `Commands to control individual buses of the XAir mixer, including mute status.`,
Use: "bus",
Run: func(cmd *cobra.Command, _ []string) { Run: func(cmd *cobra.Command, _ []string) {
cmd.Help() cmd.Help()
}, },
@ -18,9 +18,9 @@ var busCmd = &cobra.Command{
// busMuteCmd represents the bus mute command. // busMuteCmd represents the bus mute command.
var busMuteCmd = &cobra.Command{ var busMuteCmd = &cobra.Command{
Use: "mute [bus number] [true|false]",
Short: "Get or set the bus mute status", Short: "Get or set the bus mute status",
Long: `Get or set the mute status of a specific bus.`, Long: `Get or set the mute status of a specific bus.`,
Use: "mute [bus number] [true|false]",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {
@ -56,19 +56,16 @@ var busMuteCmd = &cobra.Command{
// busFaderCmd represents the bus fader command. // busFaderCmd represents the bus fader command.
var busFaderCmd = &cobra.Command{ var busFaderCmd = &cobra.Command{
Use: "fader [bus number] [level in dB]",
Short: "Get or set the bus fader level", Short: "Get or set the bus fader level",
Long: `Get or set the fader level of a specific bus. Long: `Get or set the fader level of a specific bus.
If no level argument is provided, the current fader level is retrieved. If no level argument is provided, the current fader level is retrieved.
If a level argument (in dB) is provided, the bus fader is set to that level. If a level argument (in dB) is provided, the bus fader is set to that level.`,
Use: "fader [bus number] [level in dB]",
For example: Example: ` # Get the current fader level of bus 1
# Get the current fader level of bus 1
xair-cli bus fader 1 xair-cli bus fader 1
# Set the fader level of bus 1 to -10.0 dB # Set the fader level of bus 1 to -10.0 dB
xair-cli bus fader 1 -10.0 xair-cli bus fader 1 -10.0`,
`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {
@ -106,14 +103,11 @@ For example:
// busFadeOutCmd represents the bus fade out command. // busFadeOutCmd represents the bus fade out command.
var busFadeOutCmd = &cobra.Command{ var busFadeOutCmd = &cobra.Command{
Use: "fadeout [bus number] --duration [seconds] [target level in dB]",
Short: "Fade out the bus fader over a specified duration", Short: "Fade out the bus fader over a specified duration",
Long: `Fade out the bus fader to minimum level over a specified duration in seconds. Long: "Fade out the bus fader to minimum level over a specified duration in seconds.",
Use: "fadeout [bus number] --duration [seconds] [target level in dB]",
For example: Example: ` # Fade out bus 1 over 5 seconds
# Fade out bus 1 over 5 seconds xair-cli bus fadeout 1 --duration 5 -- -90.0`,
xair-cli bus fadeout 1 --duration 5 -- -90.0
`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {
@ -170,14 +164,11 @@ For example:
// BusFadeInCmd represents the bus fade in command. // BusFadeInCmd represents the bus fade in command.
var busFadeInCmd = &cobra.Command{ var busFadeInCmd = &cobra.Command{
Use: "fadein [bus number] --duration [seconds] [target level in dB]",
Short: "Fade in the bus fader over a specified duration", Short: "Fade in the bus fader over a specified duration",
Long: `Fade in the bus fader to maximum level over a specified duration in seconds. Long: "Fade in the bus fader to maximum level over a specified duration in seconds.",
Use: "fadein [bus number] --duration [seconds] [target level in dB]",
For example: Example: ` # Fade in bus 1 over 5 seconds
# Fade in bus 1 over 5 seconds xair-cli bus fadein 1 --duration 5 -- 0.0`,
xair-cli bus fadein 1 --duration 5 -- 0.0
`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {

View File

@ -8,9 +8,9 @@ import (
// mainCmd represents the main command. // mainCmd represents the main command.
var mainCmd = &cobra.Command{ var mainCmd = &cobra.Command{
Use: "main",
Short: "Commands to control the main output", Short: "Commands to control the main output",
Long: `Commands to control the main output of the XAir mixer, including fader level and mute status.`, Long: `Commands to control the main output of the XAir mixer, including fader level and mute status.`,
Use: "main",
Run: func(cmd *cobra.Command, _ []string) { Run: func(cmd *cobra.Command, _ []string) {
cmd.Help() cmd.Help()
}, },
@ -18,24 +18,21 @@ var mainCmd = &cobra.Command{
// mainMuteCmd represents the main mute command. // mainMuteCmd represents the main mute command.
var mainMuteCmd = &cobra.Command{ var mainMuteCmd = &cobra.Command{
Use: "mute [true|false]",
Short: "Get or set the main LR mute status", Short: "Get or set the main LR mute status",
Long: `Get or set the main L/R mute status. Long: `Get or set the main L/R mute status.
If no argument is provided, the current mute status is retrieved. If no argument is provided, the current mute status is retrieved.
If "true" or "1" is provided as an argument, the main output is muted. If "true" or "1" is provided as an argument, the main output is muted.
If "false" or "0" is provided, the main output is unmuted. If "false" or "0" is provided, the main output is unmuted.`,
Use: "mute [true|false]",
For example: Example: ` # Get the current main LR mute status
# Get the current main LR mute status
xair-cli main mute xair-cli main mute
# Mute the main output # Mute the main output
xair-cli main mute true xair-cli main mute true
# Unmute the main output # Unmute the main output
xair-cli main mute false xair-cli main mute false`,
`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {
@ -54,8 +51,14 @@ For example:
} }
var muted bool var muted bool
if args[0] == "true" || args[0] == "1" { switch args[0] {
case "true", "1":
muted = true muted = true
case "false", "0":
muted = false
default:
cmd.PrintErrln("Invalid mute status. Use true/false or 1/0")
return
} }
err := client.Main.SetMute(muted) err := client.Main.SetMute(muted)
@ -69,20 +72,17 @@ For example:
// mainFaderCmd represents the main fader command. // mainFaderCmd represents the main fader command.
var mainFaderCmd = &cobra.Command{ var mainFaderCmd = &cobra.Command{
Use: "fader [level in dB]",
Short: "Set or get the main LR fader level", Short: "Set or get the main LR fader level",
Long: `Set or get the main L/R fader level in dB. Long: `Set or get the main L/R fader level in dB.
If no argument is provided, the current fader level is retrieved. If no argument is provided, the current fader level is retrieved.
If a dB value is provided as an argument, the fader level is set to that value. If a dB value is provided as an argument, the fader level is set to that value.`,
Use: "fader [level in dB]",
For example: Example: ` # Get the current main LR fader level
# Get the current main LR fader level
xair-cli main fader xair-cli main fader
# Set the main LR fader level to -10.0 dB # Set the main LR fader level to -10.0 dB
xair-cli main fader -- -10.0 xair-cli main fader -- -10.0`,
`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {
@ -111,16 +111,14 @@ For example:
// mainFadeOutCmd represents the main fadeout command. // mainFadeOutCmd represents the main fadeout command.
var mainFadeOutCmd = &cobra.Command{ var mainFadeOutCmd = &cobra.Command{
Use: "fadeout --duration [seconds] [target_db]",
Short: "Fade out the main output", Short: "Fade out the main output",
Long: `Fade out the main output over a specified duration. Long: `Fade out the main output over a specified duration.
For example:
xair-cli main fadeout --duration 10 -- -20.0
xair-cli main fadeout -- -90.0 # Uses default 5 second duration
This command will fade out the main output to the specified dB level. This command will fade out the main output to the specified dB level.
`, `,
Use: "fadeout --duration [seconds] [target_db]",
Example: ` # Fade out main output over 5 seconds
xair-cli main fadeout --duration 5 -- -90.0`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {
@ -171,17 +169,14 @@ This command will fade out the main output to the specified dB level.
// mainFadeInCmd represents the main fadein command. // mainFadeInCmd represents the main fadein command.
var mainFadeInCmd = &cobra.Command{ var mainFadeInCmd = &cobra.Command{
Use: "fadein --duration [seconds] [target_db]",
Short: "Fade in the main output", Short: "Fade in the main output",
Long: `Fade in the main output over a specified duration. Long: `Fade in the main output over a specified duration.
For example:
xair-cli main fadein --duration 10 -- -6.0
xair-cli main fadein -- -0.0 # Uses default 5 second duration
This command will fade in the main output to the specified dB level. This command will fade in the main output to the specified dB level.
`, `,
Use: "fadein --duration [seconds] [target_db]",
Example: ` # Fade in main output over 5 seconds
xair-cli main fadein --duration 5 -- 0.0`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {

View File

@ -8,9 +8,9 @@ import (
// stripCmd represents the strip command. // stripCmd represents the strip command.
var stripCmd = &cobra.Command{ var stripCmd = &cobra.Command{
Use: "strip",
Short: "Commands to control individual strips", Short: "Commands to control individual strips",
Long: `Commands to control individual strips of the XAir mixer, including fader level and mute status.`, Long: `Commands to control individual strips of the XAir mixer, including fader level and mute status.`,
Use: "strip",
Run: func(cmd *cobra.Command, _ []string) { Run: func(cmd *cobra.Command, _ []string) {
cmd.Help() cmd.Help()
}, },
@ -18,23 +18,20 @@ var stripCmd = &cobra.Command{
// stripMuteCmd represents the strip mute command. // stripMuteCmd represents the strip mute command.
var stripMuteCmd = &cobra.Command{ var stripMuteCmd = &cobra.Command{
Use: "mute [strip number] [true|false]",
Short: "Get or set the mute status of a strip", Short: "Get or set the mute status of a strip",
Long: `Get or set the mute status of a specific strip. Long: `Get or set the mute status of a specific strip.
If no argument is provided, the current mute status is retrieved. If no argument is provided, the current mute status is retrieved.
If "true" or "1" is provided as an argument, the strip is muted. If "true" or "1" is provided as an argument, the strip is muted.
If "false" or "0" is provided, the strip is unmuted. If "false" or "0" is provided, the strip is unmuted.`,
Use: "mute [strip number] [true|false]",
For example: Example: ` # Get the current mute status of strip 1
# Get the current mute status of strip 1
xair-cli strip mute 1 xair-cli strip mute 1
# Mute strip 1 # Mute strip 1
xair-cli strip mute 1 true xair-cli strip mute 1 true
# Unmute strip 1 # Unmute strip 1
xair-cli strip mute 1 false xair-cli strip mute 1 false`,
`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {
@ -85,20 +82,17 @@ For example:
// stripFaderCmd represents the strip fader command. // stripFaderCmd represents the strip fader command.
var stripFaderCmd = &cobra.Command{ var stripFaderCmd = &cobra.Command{
Use: "fader [strip number] [level in dB]",
Short: "Get or set the fader level of a strip", Short: "Get or set the fader level of a strip",
Long: `Get or set the fader level of a specific strip. Long: `Get or set the fader level of a specific strip.
If no level argument is provided, the current fader level is retrieved. If no level argument is provided, the current fader level is retrieved.
If a level argument (in dB) is provided, the strip fader is set to that level. If a level argument (in dB) is provided, the strip fader is set to that level.`,
Use: "fader [strip number] [level in dB]",
For example: Example: ` # Get the current fader level of strip 1
# Get the current fader level of strip 1
xair-cli strip fader 1 xair-cli strip fader 1
# Set the fader level of strip 1 to -10.0 dB # Set the fader level of strip 1 to -10.0 dB
xair-cli strip fader 1 -10.0 xair-cli strip fader 1 -10.0`,
`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {
@ -141,14 +135,11 @@ For example:
// stripFadeOutCmd represents the strip fade out command. // stripFadeOutCmd represents the strip fade out command.
var stripFadeOutCmd = &cobra.Command{ var stripFadeOutCmd = &cobra.Command{
Use: "fadeout [strip number] --duration [seconds] [target level in dB]",
Short: "Fade out the strip over a specified duration", Short: "Fade out the strip over a specified duration",
Long: `Fade out the strip over a specified duration in seconds. Long: "Fade out the strip over a specified duration in seconds.",
Use: "fadeout [strip number] --duration [seconds] [target level in dB]",
For example: Example: ` # Fade out strip 1 over 5 seconds
# Fade out strip 1 over 5 seconds xair-cli strip fadeout 1 --duration 5.0 -- -90.0`,
xair-cli strip fadeout 1 --duration 5.0 -- -90.0
`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {
@ -204,14 +195,11 @@ For example:
// stripFadeInCmd represents the strip fade in command. // stripFadeInCmd represents the strip fade in command.
var stripFadeInCmd = &cobra.Command{ var stripFadeInCmd = &cobra.Command{
Use: "fadein [strip number] --duration [seconds] [target level in dB]",
Short: "Fade in the strip over a specified duration", Short: "Fade in the strip over a specified duration",
Long: `Fade in the strip over a specified duration in seconds. Long: "Fade in the strip over a specified duration in seconds.",
Use: "fadein [strip number] --duration [seconds] [target level in dB]",
For example: Example: ` # Fade in strip 1 over 5 seconds
# Fade in strip 1 over 5 seconds xair-cli strip fadein 1 --duration 5.0 0`,
xair-cli strip fadein 1 --duration 5.0 0
`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {
@ -267,17 +255,14 @@ For example:
// stripSendCmd represents the strip send command. // stripSendCmd represents the strip send command.
var stripSendCmd = &cobra.Command{ var stripSendCmd = &cobra.Command{
Use: "send [strip number] [bus number] [level in dB]",
Short: "Commands to get or set strip send levels", Short: "Commands to get or set strip send levels",
Long: `Commands to get or set the send levels for individual strips. Long: "Commands to get or set the send levels for individual strips.",
Use: "send [strip number] [bus number] [level in dB]",
For example: Example: ` # Get the send level of strip 1 to bus 1
# Get the send level of strip 1 to bus 1
xair-cli strip send 1 1 xair-cli strip send 1 1
# Set the send level of strip 1 to bus 1 to -5.0 dB # Set the send level of strip 1 to bus 1 to -5.0 dB
xair-cli strip send 1 1 -- -5.0 xair-cli strip send 1 1 -- -5.0`,
`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
client := ClientFromContext(cmd.Context()) client := ClientFromContext(cmd.Context())
if client == nil { if client == nil {