mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
internal/ui is now the only package that prints: the message helpers, prompts, tty detection, the status line, the run log (Logged, step counts, proxy keys redacted) and ui.Main, which recovers Die, runs the cleanup stack and handles INT/TERM/HUP (exit 130). main runs devvm through it, and Cobra's errors print as one-line devvm errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
32 lines
796 B
Go
32 lines
796 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/w3cj/devvm/internal/msg"
|
|
"github.com/w3cj/devvm/internal/ui"
|
|
)
|
|
|
|
// newMsgCmd is devvm _msg NAME key=value...: a message's text, for the
|
|
// end-to-end tests to look for. Hidden: it's not for users.
|
|
func newMsgCmd() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "_msg NAME [key=value...]",
|
|
Short: "Print a message's text",
|
|
Hidden: true,
|
|
DisableFlagParsing: true,
|
|
Args: cobra.MinimumNArgs(1),
|
|
RunE: func(_ *cobra.Command, args []string) error {
|
|
m, err := msg.FromArgs(args[0], args[1:])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// The text whatever DEVVM_MESSAGES says: it's data here.
|
|
_, err = fmt.Fprintln(ui.Stdout(), m.Text())
|
|
return err
|
|
},
|
|
}
|
|
}
|