Skip to main content

Key-value command line argument parser

Project description

This is an example how good design decisions lead to clear solutions and how “best practices” bloat the code.

Everyone knows dd utility? So, this is an implementation of command line parser for the same syntax.

Compare it with argparse. Impressed?

You may argue that argparse does much more. Okay, I could agree with you if I did not open the documentation each time when I needed to add a few simple command line options to my new script.

Well, I don’t want to disappoint you completely, so I added a useful hack which makes the code bigger. Unfortunately, it makes your code shorter.

How to use this module

import kvargs



if 'far' in kvargs:

How to provide command line args

Same as for dd:

python3 foo=123 bar=456 far=0 near=123 near=456 near=789

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kvargs-0.3.2.tar.gz (3.0 kB view hashes)

Uploaded source

Built Distribution

kvargs-0.3.2-py3-none-any.whl (4.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page