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
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
Built Distribution
Close
Hashes for friendly_arguments-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9eb365af3515537ed838a6f5a6e7ede6393f72022fabad988a0235251569d8f |
|
MD5 | 55e3db72e3a4e90a0f428a8e9275a22f |
|
BLAKE2b-256 | a3d7518e892d2dfb9e1ee996f742726ed31004003d2d231863d67888cc0499d7 |