Initial commit on Forgejo
Fresh repository history for elektrine/tarakan-client hosted at https://git.elektrine.com/elektrine/tarakan-client.
This commit is contained in:
commit
58b29a7f84
70 changed files with 12994 additions and 0 deletions
19
internal/app/commands.go
Normal file
19
internal/app/commands.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package app
|
||||
|
||||
import "strings"
|
||||
|
||||
type command struct {
|
||||
name string
|
||||
args []string
|
||||
}
|
||||
|
||||
func parseCommand(input string) (command, bool) {
|
||||
if !strings.HasPrefix(input, "/") {
|
||||
return command{}, false
|
||||
}
|
||||
fields := strings.Fields(strings.TrimPrefix(input, "/"))
|
||||
if len(fields) == 0 {
|
||||
return command{}, false
|
||||
}
|
||||
return command{name: strings.ToLower(fields[0]), args: fields[1:]}, true
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue