refactor: handleCommand -> handleCmd
continuous-integration/drone/push Build is passing Details

This commit is contained in:
decentral1se 2024-01-10 11:04:59 +01:00
parent 15b7b19268
commit 6db960bb78
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
3 changed files with 5 additions and 5 deletions

View File

@ -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 {

View File

@ -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?`)

View File

@ -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":