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

Add useful info to AddPositionalValue panic. #77

Merged
merged 1 commit into from Apr 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions subCommand.go
Expand Up @@ -656,14 +656,14 @@ func (sc *Subcommand) AddPositionalValue(assignmentVar *string, name string, rel
// ensure no other positionals are at this depth
for _, other := range sc.PositionalFlags {
if relativePosition == other.Position {
log.Panicln("Unable to add positional value because one already exists at position: " + strconv.Itoa(relativePosition))
log.Panicln("Unable to add positional value " + name + " because " + other.Name + " already exists at position: " + strconv.Itoa(relativePosition))
}
}

// ensure no subcommands at this depth
for _, other := range sc.Subcommands {
if relativePosition == other.Position {
log.Panicln("Unable to add positional value a subcommand already exists at position: " + strconv.Itoa(relativePosition))
log.Panicln("Unable to add positional value " + name + "because a subcommand, " + other.Name + ", already exists at position: " + strconv.Itoa(relativePosition))
}
}

Expand Down