abiosoft / abiosoft/ishell

AddCmd with Name having spaces causes the command to not execute

Offen
#155 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Go
Sterne
1.8k
Forks
213
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

using this example raises the error `Error: incorrect input, try 'help'`:

```go
shell.AddCmd(&ishell.Cmd{
Name: "test cmd example",
Help: "test cmd",
LongHelp: "Turn syslog OFF.",
Func: func(c *ishell.Context) {
c.Println("test")
},
})
```

tried like this:

```go
{
ishell_cmd := &ishell.Cmd{
Name: "test",
Help: "test func",
}
ishell_cmd.AddCmd(&ishell.Cmd{
Name: "cmd example",
Help: "cmd example help text",
LongHelp: "Turn syslog OFF.",
Func: func(c *ishell.Context) {
c.Println("test")
},
})
shell.AddCmd(ishell_cmd)
}
```

makes it print the help:

```
>>> test cmd example

test func

Commands:
cmd example cmd example help text
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.