refactor: handleCommand -> handleCmd
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
15b7b19268
commit
6db960bb78
|
@ -18,7 +18,7 @@ const cmdHelp = `/acn on | Turn on the Tor
|
|||
/start | Show getting started guide
|
||||
/quit | Quit the program`
|
||||
|
||||
func handleCommand(cmd, hiddenInput string) tea.Msg {
|
||||
func handleCmd(cmd, hiddenInput string) tea.Msg {
|
||||
cmds := strings.Split(cmd, " ")
|
||||
|
||||
switch {
|
||||
|
|
|
@ -24,7 +24,7 @@ func TestHandleCommandTypes(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
msg := handleCommand(test.cmdInput, test.hiddenInput)
|
||||
msg := handleCmd(test.cmdInput, test.hiddenInput)
|
||||
switch msg := msg.(type) {
|
||||
default:
|
||||
assert.IsType(t, msg, test.cmdOutput)
|
||||
|
@ -33,7 +33,7 @@ func TestHandleCommandTypes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHandleCommandUnknownCommand(t *testing.T) {
|
||||
msg := handleCommand("foo", "")
|
||||
msg := handleCmd("foo", "")
|
||||
switch msg := msg.(type) {
|
||||
case cmdMsg:
|
||||
assert.Equal(t, msg.output, []string{unknownCmdHelp})
|
||||
|
@ -43,7 +43,7 @@ func TestHandleCommandUnknownCommand(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHandleCommandIncorrectCommand(t *testing.T) {
|
||||
msg := handleCommand("profile foo", "")
|
||||
msg := handleCmd("profile foo", "")
|
||||
switch msg := msg.(type) {
|
||||
case cmdMsg:
|
||||
assert.Contains(t, msg.output, `Unknown "profile" command?`)
|
||||
|
|
|
@ -253,7 +253,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
}
|
||||
|
||||
cmds = append(cmds, func() tea.Msg {
|
||||
return handleCommand(cmdInput[1:], m.hiddenInput)
|
||||
return handleCmd(cmdInput[1:], m.hiddenInput)
|
||||
})
|
||||
|
||||
case "ctrl+n":
|
||||
|
|
Reference in New Issue