mosquito / argclass

A wrapper around the standard argparse module that allows you to describe argument parsers declaratively
Apache License 2.0
12 stars 3 forks source link

Empty Option Group Prefix is Ignored #11

Open daskol opened 1 year ago

daskol commented 1 year ago

Option groups ignores empty prefix (empty string '' behaves like None) for option names.

class LearningOptions(Group):
    batch_size: int = 256
    learning_rate: float = 1e-1

class Namespace(Parser):
    learning_opts = LearningOptions(title='learning options', prefix='')

Expected options are following.

learning options:
  --batch-size BATCH_SIZE
                        (default: 256)
  --learning-rate LEARNING_RATE
                        (default: 0.1)

Actually we have these options.

learning options:
  --learning-opts-batch-size LEARNING_OPTS_BATCH_SIZE
                        (default: 256)
  --learning-opts-learning-rate LEARNING_OPTS_LEARNING_RATE
                        (default: 0.1)