fixed len 1 and 0 args and flags

This commit is contained in:
Laukka 2025-01-13 10:55:44 +01:00
parent 06544fa371
commit aad4da3077

View File

@ -36,8 +36,11 @@ func parse(input string) Input {
var flags []string
var args []string
for _, arg := range split[1:] {
if len(arg) == 1 && arg[0] == '-' {
continue
if len(arg) == 1 {
if arg[0] == '-' {
continue
}
_ = append(args, string(arg[0]))
} else if arg[0:2] == "--" {
var result = strings.TrimSpace(arg)
flags = append(flags, string(result[2:]))
@ -99,7 +102,7 @@ func input_str(env *environment.Env) string {
history_index++
input = env.History[history_index]
} else {
history_index = len(env.History)-1
history_index = len(env.History) - 1
input = ""
if r, _, _ := reader.ReadRune(); r == 65 { // UPP
if history_index > 0 {