From aad4da307791933f8329ebba061ec9d01a13397c Mon Sep 17 00:00:00 2001 From: Laukka Date: Mon, 13 Jan 2025 10:55:44 +0100 Subject: [PATCH] fixed len 1 and 0 args and flags --- input_parser/input_parser.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/input_parser/input_parser.go b/input_parser/input_parser.go index 19e71aa..41481fe 100644 --- a/input_parser/input_parser.go +++ b/input_parser/input_parser.go @@ -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 {