Skip to content

Commit

Permalink
corrections done for release version 0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Palani-SN committed Jun 7, 2024
1 parent de33155 commit 3973e12
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 44 deletions.
5 changes: 3 additions & 2 deletions EXAMPLES/use_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def parse_args(self,
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand Down
35 changes: 21 additions & 14 deletions EXAMPLES/use_moderate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def multi_args1(self,
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> ~<__func__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> ~<__func__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand All @@ -44,8 +45,9 @@ def multi_args2(self,
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> ~<__func__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> ~<__func__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand All @@ -70,8 +72,9 @@ def multi_args3(self,
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> ~<__func__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> ~<__func__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand All @@ -96,8 +99,9 @@ def multi_args4(self,
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> ~<__func__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> ~<__func__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand All @@ -122,8 +126,9 @@ def multi_args5(self,
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> ~<__func__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> ~<__func__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand All @@ -148,8 +153,9 @@ def multi_args6(self,
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> ~<__func__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> ~<__func__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand All @@ -174,8 +180,9 @@ def multi_args7(self,
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> ~<__func__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> ~<__func__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand Down
52 changes: 25 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

## Minimal

- minimal arg parser that can pass on the cli arguments to parse_args class method arguments as per the declarative type definition.
- minimal arg parser that can pass on the cli arguments to parse_args class method arguments as per the declarative type definition. (works fine on windows & linux)
- Sample code as shown below can read arguments in specified type as per function signature. (refer **use_minimal.py** under **EXAMPLES/**)

```python
Expand All @@ -39,8 +39,8 @@ class multi_args(arg_parser):
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand Down Expand Up @@ -70,8 +70,7 @@ if __name__ == '__main__':
- To get help on how to use the script, execute **python use_minimal.py -h** or **python use_minimal.py --help** which will generate the doc content based on the comments in script as shown below.

```output
(py4cli) D:\GitRepos\py4cli\EXAMPLES>python use_minimal.py --help
(examples) D:\GitRepos\py4cli\EXAMPLES>python use_minimal.py --help
['use_minimal.py', '--help']
| > def parse_args
Expand All @@ -96,8 +95,8 @@ if __name__ == '__main__':
| the function returns a dict containing all the arguments and its values.
|
| cmds :
| 1. python use_minimal.py 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
| 2. python use_minimal.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
| 1. python D:\GitRepos\py4cli\EXAMPLES\use_minimal.py 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
| 2. python D:\GitRepos\py4cli\EXAMPLES\use_minimal.py -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
|
| -> dict (Returnable)
Expand All @@ -110,7 +109,7 @@ None <class 'NoneType'>
```
output
(py4cli) D:\GitRepos\py4cli\EXAMPLES>python use_minimal.py
(examples) D:\GitRepos\py4cli\EXAMPLES>python use_minimal.py
['use_minimal.py']
{
Expand All @@ -130,8 +129,8 @@ output
"inp_str": "Six"
} <class 'dict'>
(py4cli) D:\GitRepos\py4cli\EXAMPLES>python use_minimal.py 100 100.0 "parse args example function call" [1,2,3,4,5,6]
['use_minimal.py', '100', '100.0', 'parse args example function call', '[1,2,3,4,5,6]']
(examples) D:\GitRepos\py4cli\EXAMPLES>python use_minimal.py 100 100.0 "parse args example function call" "[1, 2, 3, 4, 5, 6]"
['use_minimal.py', '100', '100.0', 'parse args example function call', '[1, 2, 3, 4, 5, 6]']
{
"inp_bool": false,
Expand All @@ -153,8 +152,8 @@ output
"inp_str": "parse args example function call"
} <class 'dict'>
(py4cli) D:\GitRepos\py4cli\EXAMPLES>python use_minimal.py -inp_int=100 -inp_float=100.0 -inp_str="parse args example function call" -inp_list=[1,2,3,4,5,6]
['use_minimal.py', '-inp_int=100', '-inp_float=100.0', '-inp_str=parse args example function call', '-inp_list=[1,2,3,4,5,6]']
(examples) D:\GitRepos\py4cli\EXAMPLES>python use_minimal.py -inp_int=100 -inp_float=100.0 -inp_str="parse args example function call" -inp_list="[1, 2, 3, 4, 5, 6]"
['use_minimal.py', '-inp_int=100', '-inp_float=100.0', '-inp_str=parse args example function call', '-inp_list=[1, 2, 3, 4, 5, 6]']
{
"inp_bool": false,
Expand All @@ -176,8 +175,8 @@ output
"inp_str": "parse args example function call"
} <class 'dict'>
(py4cli) D:\GitRepos\py4cli\EXAMPLES>python use_minimal.py 100 100.0 -inp_str="parse args example function call" -inp_list=[1,2,3,4,5,6]
['use_minimal.py', '100', '100.0', '-inp_str=parse args example function call', '-inp_list=[1,2,3,4,5,6]']
(examples) D:\GitRepos\py4cli\EXAMPLES>python use_minimal.py 100 100.0 -inp_str="parse args example function call" -inp_list="[1, 2, 3, 4, 5, 6]"
['use_minimal.py', '100', '100.0', '-inp_str=parse args example function call', '-inp_list=[1, 2, 3, 4, 5, 6]']
{
"inp_bool": false,
Expand Down Expand Up @@ -227,8 +226,8 @@ class vscaled_args(arg_parser):
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> ~<__func__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> ~<__func__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand All @@ -253,8 +252,8 @@ class vscaled_args(arg_parser):
the function returns a dict containing all the arguments and its values.
cmds :
1. python <__file__> ~<__func__> 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
1. python <__file__> ~<__func__> 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
2. python <__file__> ~<__func__> -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
"""
return {
'inp_int': inp_int,
Expand Down Expand Up @@ -285,7 +284,7 @@ if __name__ == '__main__':

```output
(py4cli) D:\GitRepos\py4cli\EXAMPLES>python use_moderate.py
(examples) D:\GitRepos\py4cli\EXAMPLES>python use_moderate.py
['use_moderate.py']
Methods available for use, is listed below
[
Expand All @@ -295,7 +294,7 @@ Methods available for use, is listed below
None <class 'NoneType'>
(py4cli) D:\GitRepos\py4cli\EXAMPLES>python use_moderate.py --help
(examples) D:\GitRepos\py4cli\EXAMPLES>python use_moderate.py --help
['use_moderate.py', '--help']
| > def multi_args1
Expand All @@ -320,8 +319,8 @@ None <class 'NoneType'>
| the function returns a dict containing all the arguments and its values.
|
| cmds :
| 1. python use_moderate.py ~multi_args1 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
| 2. python use_moderate.py ~multi_args1 -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
| 1. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args1 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
| 2. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args1 -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
|
| -> dict (Returnable)
Expand All @@ -347,9 +346,8 @@ None <class 'NoneType'>
| the function returns a dict containing all the arguments and its values.
|
| cmds :
| 1. python use_moderate.py ~multi_args2 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True
| 2. python use_moderate.py ~multi_args2 -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True
| 1. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args2 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True
| 2. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args2 -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True
|
| -> dict (Returnable)
Expand All @@ -362,8 +360,8 @@ None <class 'NoneType'>
```
output
(py4cli) D:\GitRepos\py4cli\EXAMPLES>python use_moderate.py ~multi_args1 100 100.0 "multi_args1 example function call" [1,2,3,4,5,6] ~multi_args2 -inp_int=100 -inp_float=100.0 -inp_str="multi_args2 example function call" -inp_list=[1,2,3,4,5,6]
['use_moderate.py', '~multi_args1', '100', '100.0', 'multi_args1 example function call', '[1,2,3,4,5,6]', '~multi_args2', '-inp_int=100', '-inp_float=100.0', '-inp_str=multi_args2 example function call', '-inp_list=[1,2,3,4,5,6]']
(examples) D:\GitRepos\py4cli\EXAMPLES>python use_moderate.py ~multi_args1 100 100.0 "multi_args1 example function call" "[1, 2, 3, 4, 5, 6]" ~multi_args2 -inp_int=100 -inp_float=100.0 -inp_str="multi_args2 example function call" -inp_list="[1, 2, 3, 4, 5, 6]"
['use_moderate.py', '~multi_args1', '100', '100.0', 'multi_args1 example function call', '[1, 2, 3, 4, 5, 6]', '~multi_args2', '-inp_int=100', '-inp_float=100.0', '-inp_str=multi_args2 example function call', '-inp_list=[1, 2, 3, 4, 5, 6]']
{
"multi_args1": {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="py4cli",
version="0.0.5",
version="0.0.6",
description="python for command line interface development",
py_modules=["py4cli/minimal", "py4cli/moderate"],
package_dir={"": "SRCS"},
Expand Down

0 comments on commit 3973e12

Please sign in to comment.