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.

Similar to argparse, switching is no problem at all! You can even use the FlagParserExtended 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:

from ezflags.ext import FlagParserExtended

parser = FlagParserExtended()
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.

Source Distribution

ezflags-1.4.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

ezflags-1.4.2-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file ezflags-1.4.2.tar.gz.

File metadata

  • Download URL: ezflags-1.4.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1

File hashes

Hashes for ezflags-1.4.2.tar.gz
Algorithm Hash digest
SHA256 2621362e3d7c16a804b8bb5bcdd380225587321fe71c975416521f063938e4e5
MD5 4c60bdabe8b9d2b85f54decfb96f7400
BLAKE2b-256 e6c78859a4e76d193998fa3fff749295842bcf720751ea08bca530a3a2a4bbd7

See more details on using hashes here.

File details

Details for the file ezflags-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: ezflags-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1

File hashes

Hashes for ezflags-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 147eba0d3cb619c809489c1efe580d5b12e321c9f24ebb9b5aabb4c6c2674a12
MD5 ea675560a10c6cce933316e1fd2fb4da
BLAKE2b-256 031bedefcea90f8b4b1f2c80485e61fddba0b5b59bace6a742b8fbd25f617bd2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page