-
Notifications
You must be signed in to change notification settings - Fork 3
enhancement: Bare subcommand-parent commands (docker, kubectl) allowed with no args #72
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestpriority: lowNice to fix - minor improvementNice to fix - minor improvement
Description
Summary
When a subcommand-parent command like docker or kubectl is invoked with zero arguments, the len(args) > 0 check fails and validation falls through to the generic manifest lookup. If a base manifest exists for the parent (e.g., docker), the bare command passes validation.
Location
validator/validator.go:48-50
if manifest.SubcommandCommands[command] && len(args) > 0 {
return validateSubcommand(command, args, registry)
}Impact
Low — bare docker, kubectl, etc. just show help text, which is harmless. But it creates an inconsistency: docker images is rejected (no manifest) while bare docker is allowed.
Suggested Fix
Either require a subcommand for commands in SubcommandCommands, or document this as intentional:
if manifest.SubcommandCommands[command] {
if len(args) == 0 {
return &ValidationError{Message: fmt.Sprintf("'%s' requires a subcommand.", command)}
}
return validateSubcommand(command, args, registry)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpriority: lowNice to fix - minor improvementNice to fix - minor improvement