feat(01-03): add deterministic rich CLI output
- Inject bonfire.Output from stdin/stdout/stderr with stdlib widgets and x/term - Degrade spinner, progress, table and prompts without a TTY or color - Reject plugin command names that are not namespace:verb
This commit is contained in:
@@ -10,7 +10,11 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
root := bonfire.NewRoot("summer", toolCommands(), os.Stdout)
|
||||
root, err := bonfire.NewRoot("summer", toolCommands(), os.Stdout)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
root.SetArgs(os.Args[1:])
|
||||
if err := root.Execute(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
|
||||
@@ -26,7 +26,10 @@ func TestToolCommandNames(t *testing.T) {
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
root := bonfire.NewRoot("summer", toolCommands(), &buf)
|
||||
root, err := bonfire.NewRoot("summer", toolCommands(), &buf)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
root.SetArgs([]string{"make:plugin", "--help"})
|
||||
if err := root.Execute(); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user