Skip to content

Validation errors identify an argument by its numeric position #54

Description

@HafizMMoaz

Argument definitions are keyed by position and have no name, so validateDefinitions() puts the raw index into the message (src/Command.php:359):

protected array $argumentDefinitions = [
    0 => ["type" => "string", "required" => true],
];
php app deploy
# argument "0" is required.

The user has no way to know what argument 0 is meant to be, and the generated help does not print the definitions either (#49), so there is nowhere to look it up.

Suggested fix: let a definition carry a name (and ideally a description), fall back to the position when it is absent, and use the name in the message:

argument "environment" is required.

The same name then feeds the Usage: and Arguments: blocks in #49, so a command declares each input once instead of describing it in $usage by hand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions