Skip to content

Feature request: allow setting exit code on custom validation error #1239

Open
@heaths

Description

@heaths

In the process of upgrading a project to System.CommandLine v2, I'd like to move more validation up front but return exit codes specific to the validation error. For example, in a project in a command handler, they check if a string is a valid absolute URI and return a specific exit code if not. I can return the same message, but System.CommandLine just returns 1 for any argument validation errors. It would be nice if we could optionally return an exit code - perhaps by providing the context that's passed to middleware, for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions