fixed len 1 and 0 args and flags
This commit is contained in:
parent
06544fa371
commit
aad4da3077
@ -36,8 +36,11 @@ func parse(input string) Input {
|
|||||||
var flags []string
|
var flags []string
|
||||||
var args []string
|
var args []string
|
||||||
for _, arg := range split[1:] {
|
for _, arg := range split[1:] {
|
||||||
if len(arg) == 1 && arg[0] == '-' {
|
if len(arg) == 1 {
|
||||||
continue
|
if arg[0] == '-' {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
_ = append(args, string(arg[0]))
|
||||||
} else if arg[0:2] == "--" {
|
} else if arg[0:2] == "--" {
|
||||||
var result = strings.TrimSpace(arg)
|
var result = strings.TrimSpace(arg)
|
||||||
flags = append(flags, string(result[2:]))
|
flags = append(flags, string(result[2:]))
|
||||||
@ -99,7 +102,7 @@ func input_str(env *environment.Env) string {
|
|||||||
history_index++
|
history_index++
|
||||||
input = env.History[history_index]
|
input = env.History[history_index]
|
||||||
} else {
|
} else {
|
||||||
history_index = len(env.History)-1
|
history_index = len(env.History) - 1
|
||||||
input = ""
|
input = ""
|
||||||
if r, _, _ := reader.ReadRune(); r == 65 { // UPP
|
if r, _, _ := reader.ReadRune(); r == 65 { // UPP
|
||||||
if history_index > 0 {
|
if history_index > 0 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user