Providing a straightforward way to create command-line arguments.
Project description
jarguments
simplifying args jargon
Summary
Providing a straightforward way to create command-line arguments.
Works on Python 3.6 and above. Tested on Windows 10.
Contents
Installation
git clone https://github.com/silvncr/jarguments.git
cd jarguments
python setup.py install
Usage
Library
There are three steps to using the jarguments library:
-
Import the jarguments library.
from jarguments import *
-
Provide your arguments with jarguments' classes.
args = JParser( JBool('show_text', help='determines whether "text" is shown'), JStr('text'), )
-
Use your outputs; they are parsed automatically.
if args.show_text: print(args.text)
Command-line
-
Now you can run your script with arguments:
$ python script.py --show_text --text "hello world" hello world
-
Arguments without a default value are required. If you don't provide them, the script will raise an error:
$ python script.py --show_text error: the following arguments are required: --text
-
If you want to see help messages, run your script with the
-h
or--help
flag:$ python script.py -h usage: script.py [-h] [--show_text] --text TEXT options: -h, --help show this help message and exit --show_text [SHOW_TEXT] determines whether "text" is shown --text TEXT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jarguments-0.0.1.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for jarguments-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a60c2bf0bd0628c65c9c862fe521bdbdae0ec1d92ad52f30d24c0bc70871b4c8 |
|
MD5 | 050c6495423b673e55b497495ce1b5c4 |
|
BLAKE2b-256 | 88506df042ec968990c8c0cc1c63c5f33d1b2e8be1b00eb684cefaac6d8a8bfe |