Skip to content

How to create required CLI config options? #828

@metaperl

Description

@metaperl

In #490 this issue was raised and then closed by @rmorshea.

However,

So:

  1. How does one flag an attribute as mandatory?
  2. Is this documented and did I miss it?

Here is a code sample for you to elide with what is necessary to make the req attribute mandatory:

class App(Application):
    optional_arg = Int(config=True)
    req = Unicode(config=True)

I'm expecting an exception to be thrown when I invoke this app without providing req:

python my_app.py --App.optional_arg=5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions