Skip to main content

A tool that makes creating command line flags super easy.

Project description

https://travis-ci.com/karx1/ezflags.svg?branch=master PyPI package Documentation Status

A tool that makes creating command line flags super easy.

Built on argparse, switching is no problem at all! You can even use the FlagParser as if it were a normal ArgumentParser for full integration with existing arguments.

Install with:

pip install ezflags

Here’s a simple example:

# main.py
import ezflags

parser = ezflags.FlagParser()
parser.add_flag('--flag', '-f', value=True, help="A demo flag.")

flags = parser.parse_flags()
print(flags.flag)

To integrate with ArgumentParser:

import ezflags

parser = ezflags.FlagParser()
parser.add_flag('--flag', '-f', value=True, help="A demo flag.")
parser.add_argument('--arg', '-a', help="A demo argument.")

args = parser.parse_args() # Flags are included, too!
print(args.flag)
print(args.arg)

This can be invoked as such:

python main.py --flag
# With ArgumentParser()
python main.py --flag --arg arg

View the full documentation here.

Supports

Supports Python 3.6 and up.

License

MIT license. See the LICENSE file for more details.

Project details


Download files

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

Files for ezflags, version 1.3.2
Filename, size File type Python version Upload date Hashes
Filename, size ezflags-1.3.2-py3-none-any.whl (5.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size ezflags-1.3.2.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page