mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore(cli): rename Cmd to Command (#12616)
I think Command is cleaner and my original decision to use "Cmd" a mistake. Plus this creates better parity with cobra.
This commit is contained in:
@@ -56,7 +56,7 @@ func (l *logWriter) Write(p []byte) (n int, err error) {
|
||||
}
|
||||
|
||||
func NewWithCommand(
|
||||
t testing.TB, cmd *serpent.Cmd, args ...string,
|
||||
t testing.TB, cmd *serpent.Command, args ...string,
|
||||
) (*serpent.Invocation, config.Root) {
|
||||
configDir := config.Root(t.TempDir())
|
||||
// I really would like to fail test on error logs, but realistically, turning on by default
|
||||
|
||||
@@ -48,7 +48,7 @@ func DefaultCases() []CommandHelpCase {
|
||||
|
||||
// TestCommandHelp will test the help output of the given commands
|
||||
// using golden files.
|
||||
func TestCommandHelp(t *testing.T, getRoot func(t *testing.T) *serpent.Cmd, cases []CommandHelpCase) {
|
||||
func TestCommandHelp(t *testing.T, getRoot func(t *testing.T) *serpent.Command, cases []CommandHelpCase) {
|
||||
t.Parallel()
|
||||
rootClient, replacements := prepareTestData(t)
|
||||
|
||||
@@ -148,7 +148,7 @@ func NormalizeGoldenFile(t *testing.T, byt []byte) []byte {
|
||||
return byt
|
||||
}
|
||||
|
||||
func extractVisibleCommandPaths(cmdPath []string, cmds []*serpent.Cmd) [][]string {
|
||||
func extractVisibleCommandPaths(cmdPath []string, cmds []*serpent.Command) [][]string {
|
||||
var cmdPaths [][]string
|
||||
for _, c := range cmds {
|
||||
if c.Hidden {
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
// non-root commands (like 'groups' or 'users'), a handler is required.
|
||||
// These handlers are likely just the 'help' handler, but this must be
|
||||
// explicitly set.
|
||||
func HandlersOK(t *testing.T, cmd *serpent.Cmd) {
|
||||
cmd.Walk(func(cmd *serpent.Cmd) {
|
||||
func HandlersOK(t *testing.T, cmd *serpent.Command) {
|
||||
cmd.Walk(func(cmd *serpent.Command) {
|
||||
if cmd.Handler == nil {
|
||||
// If you see this error, make the Handler a helper invoker.
|
||||
// Handler: func(inv *serpent.Invocation) error {
|
||||
|
||||
Reference in New Issue
Block a user