Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/argparse #42

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Feature/argparse #42

wants to merge 6 commits into from

Conversation

marquiz
Copy link
Contributor

@marquiz marquiz commented Jan 15, 2018

No description provided.

@marquiz marquiz force-pushed the feature/argparse branch 2 times, most recently from 56fc461 to 422f929 Compare January 15, 2018 11:27
@marquiz marquiz force-pushed the feature/argparse branch 2 times, most recently from ea4813e to e8ff551 Compare March 1, 2018 13:39
@marquiz
Copy link
Contributor Author

marquiz commented Mar 22, 2018

ping @agx: any thoughts or comments on this?

@marquiz marquiz force-pushed the feature/argparse branch 2 times, most recently from 1efcedf to 5e94679 Compare September 14, 2018 10:41
Utilize the newer and more flexible argparse module instead of optparse.
Configuration file loading is handled in a separate class.

This patch implements a gbp-specific argparser class for handling prefix
and using the config as default values. The parser is actually a wrapper
class around argument parser and argument groups in order to avoid
inheriting private classes of the argparse module. All gbp commands are
changed to use the newly added gbp-specific argparser.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Previously, adding a config file arg with no help resulted in KeyError
if no default help text was defined. Now, it is possible to add a config
arg without a help text. This makes the argument parser more consistent
as adding "non-conf-file-args" requires no help text, either.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Raise an exception if the queried option is not in the list of valid
config file args.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Rework pq and pq-rpm commands to utilize the subparsers (or subcommands)
functionality of Python argparse.

This changes the calling convention slightly: now the action (export,
import, ...) must be the first argument - all other cmdline
arguments/options must be given after that. E.g. it is not possible to
do 'gbp pq -v export' anymore, but, one must use 'gbp pq export -v'.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
There is no need to provide a default when 'store_true' or 'store_false'
action is used.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
These are the defaults automatically provided by argparse. This
hopefully slightly improves readability of the code.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants