Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddCmd with Name having spaces causes the command to not execute #155

Open
precla opened this issue Feb 24, 2025 · 0 comments
Open

AddCmd with Name having spaces causes the command to not execute #155

precla opened this issue Feb 24, 2025 · 0 comments

Comments

@precla
Copy link

precla commented Feb 24, 2025

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

	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:

	{
		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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant