package core

import "strings"

// SplitCommandAndArg splits "cmd arg" into its two parts.
// Returns (cmd, arg, true) if a space separator is found,
// or ("", "", false) if the input has no space or is empty.
func SplitCommandAndArg(input string) (cmd, arg string, ok bool) {
	trimmed := strings.TrimSpace(input)
	idx := strings.Index(trimmed, " ")
	if idx == -1 {
		return "", "", false
	}
	cmd = strings.TrimSpace(trimmed[:idx])
	arg = strings.TrimSpace(trimmed[idx+1:])
	if cmd == "" {
		return "", "", false
	}
	return cmd, arg, true
}
