mirror of
https://github.com/onyx-and-iris/gobs-cli.git
synced 2025-06-30 23:40:29 +01:00
add --no-border flag
use it to disable table border styling
This commit is contained in:
parent
bbc6aec230
commit
08f23fe47d
9
main.go
9
main.go
@ -26,7 +26,8 @@ type ObsConfig struct {
|
|||||||
|
|
||||||
// StyleConfig holds the configuration for styling the CLI output.
|
// StyleConfig holds the configuration for styling the CLI output.
|
||||||
type StyleConfig struct {
|
type StyleConfig struct {
|
||||||
Style string `help:"Style used in output." flag:"style" default:"" env:"GOBS_STYLE" short:"s" enum:",red,magenta,purple,blue,cyan,green,yellow,orange,white,grey,navy,black"`
|
Style string `help:"Style used in output." flag:"style" default:"" env:"GOBS_STYLE" short:"s" enum:",red,magenta,purple,blue,cyan,green,yellow,orange,white,grey,navy,black"`
|
||||||
|
NoBorder bool `help:"Disable table border styling in output." flag:"no-border" default:"false" env:"GOBS_STYLE_NO_BORDER" short:"b"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CLI is the main command line interface structure.
|
// CLI is the main command line interface structure.
|
||||||
@ -62,11 +63,11 @@ type context struct {
|
|||||||
Style *Style
|
Style *Style
|
||||||
}
|
}
|
||||||
|
|
||||||
func newContext(client *goobs.Client, out io.Writer, styleName string) *context {
|
func newContext(client *goobs.Client, out io.Writer, styleCfg StyleConfig) *context {
|
||||||
return &context{
|
return &context{
|
||||||
Client: client,
|
Client: client,
|
||||||
Out: out,
|
Out: out,
|
||||||
Style: styleFromFlag(styleName),
|
Style: styleFromFlag(styleCfg),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ func main() {
|
|||||||
client, err := connectObs(cli.ObsConfig)
|
client, err := connectObs(cli.ObsConfig)
|
||||||
ctx.FatalIfErrorf(err)
|
ctx.FatalIfErrorf(err)
|
||||||
|
|
||||||
ctx.Bind(newContext(client, os.Stdout, cli.StyleConfig.Style))
|
ctx.Bind(newContext(client, os.Stdout, cli.StyleConfig))
|
||||||
|
|
||||||
ctx.FatalIfErrorf(run(ctx, client))
|
ctx.FatalIfErrorf(run(ctx, client))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user