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

Panic when requesting non-existent argument #5

Open
dealloc opened this issue Aug 16, 2016 · 0 comments
Open

Panic when requesting non-existent argument #5

dealloc opened this issue Aug 16, 2016 · 0 comments

Comments

@dealloc
Copy link

dealloc commented Aug 16, 2016

I mistyped one of the arguments in the command handler, which caused a panic.

My command was registered like this

add := clif.NewCommand("add", "Add a new package to the directory", addCommand)
add.NewArgument("packages", "The package(s) to install.", "", true, true)

And in my handler I had this:

func addCommand(cmd *clif.Command) {
    packages := cmd.Argument("package").Strings()
    fmt.Println("To install: ", strings.Join(packages, ", "))
}

If you run the code above you get something like this:
1471347951

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