Compare commits
No commits in common. "6a389be6a777139330177746b35d376aef7a77b0" and "fa6f06f639f0ce5b76e419578ffae90efca77c3a" have entirely different histories.
6a389be6a7
...
fa6f06f639
@ -51,9 +51,6 @@ func BuildURI(rawuri, rawpath string) string {
|
||||
}
|
||||
|
||||
func HasCommand(s, prefix, cmd string) bool {
|
||||
s = strings.TrimSpace(s)
|
||||
|
||||
// a command cannot be less than two characters e.g. !x
|
||||
if len(s) < 2 {
|
||||
return false
|
||||
}
|
||||
@ -68,21 +65,3 @@ func HasCommand(s, prefix, cmd string) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func SplitCommandAndArgs(s, prefix string) (cmd string, args []string) {
|
||||
s = strings.TrimSpace(s)
|
||||
|
||||
x := strings.Split(s, " ")
|
||||
|
||||
if len(x) > 1 {
|
||||
args = x[1:]
|
||||
}
|
||||
|
||||
cmd = x[0]
|
||||
|
||||
if strings.Index(s, prefix) == 0 {
|
||||
cmd = cmd[len(prefix):]
|
||||
}
|
||||
|
||||
return cmd, args
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user