Skip to content

Add trap for null subparser to avoid exception in CLI corner case where options are provided but subparser is not #239

@bskinn

Description

@bskinn

More idiomatic that way, and should provide a sensible argparse failed exit for things like sphobjinv --foo, instead of a mysterious exception deeper in the CLI code.

Annoying I had to monkeypatch argparse._VersionAction.__call__() to have the newlines not get swallowed up, but what can you do?

While argparse is not likely to change much over time, the above approach (see (tag)[https://github.com/bskinn/sphobjinv/tree/wontfix-required-subparser]) just really seemed too brittle.

Much better just to trap for a null subparser in the CLI code and cleanly error-exit.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions