mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
32 lines
798 B
Go
32 lines
798 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/devvmhq/devvm/internal/msg"
|
|
"github.com/devvmhq/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(u *ui.UI) *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "_msg NAME [key=value...]",
|
|
Short: "Print a message's text",
|
|
Hidden: true,
|
|
DisableFlagParsing: true,
|
|
Args: minArgs(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(u.Stdout(), m.Text())
|
|
return err
|
|
},
|
|
}
|
|
}
|