Skip to content

Commit

Permalink
add info about ease of use feature
Browse files Browse the repository at this point in the history
  • Loading branch information
d33pster committed Apr 12, 2024
1 parent c49dd79 commit 7cd5c03
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,28 @@ _what_is_(self, arg: str)
usage:
```console
>>> optionCTRL = options(shortargs, longargs, gotargs)
>> optionCTRL._argparse()
>>> args, check, error, falseargs = optionCTRL._argparse()

>>> optionCTRL._what_is_(shortargs[0])
>>> optionCTRL._what_is_(args[0])

or

>>> optionCTRL._what_is_(longargs[0])
>>> optionCTRL._what_is_(args[1])
```
```python
# NOTE: if the user provided a longarg say --input, _what_is_ can be used with the corresponding shortarg, in this case it is -i, to find the value.

## For example:
optCTRL = options(shortargs, longargs, argv[1:])
args, check, error, falseargs = optCTRL._argparse()

# now it doesn't matter a longarg or a short arg is passed.
# calling _what_is_ with the shortarg or longarg will return the value.

if '-i' in args or '--input' in args:
print(optCTRL._what_is_('i')) # or print(optCTRL._what_is_('input'))

# so if the user provided --input, if we call _what_is('i'), we can get the value.
# or if the user provided -i, we can call _what_is_('input'), to get the value.
# NOTE: this is an ease of use feature, only available for v1.5.2 and above.
```

0 comments on commit 7cd5c03

Please sign in to comment.