Skip to main content

Easy way to use named arguments by means of python dictionaries

Project description

FriendlyArguments

This python package makes it easy to use command line argument

Example

CODE file: test_args.py

# import friendly_arguments
from friendly_arguments.named import get_params_sys_args

# Make a function call, passing as an argument a list of strings, 
# with the prefix '-' or '--' and the suffix '='. example '--arg1=' or '-arg1='
my_args: dict = get_params_sys_args(['--text='])

# validate your arguments as you wish
try:
    text1 = my_args['--text=']
except KeyError:
    raise ValueError('argumets --text= empty')

print(text1)

RUN on terminal

python test_args.py --text=hello_world
# or 
python test_args.py --text="hello world"

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

friendly-arguments-0.1.0.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

friendly_arguments-0.1.0-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

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