You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a basic DocOps string that fails when a command is added.
Here is the script
#!/usr/bin/env python
"""
Usage:
ops.py app
ops.py (-h | --help)
ops.py (-v | --version)
Options:
app call the app
-v --version Version Information
-h --help Usage help.
"""
import shtab
from argopt import argopt
from docopt import docopt
if __name__ == "__main__":
arguments = docopt(__doc__)
print(arguments)
parser = argopt(__doc__)
shtab.add_argument_to(parser, ["-s", "--print-completion"]) # magic!
args = parser.parse_args()
print("Profit!")
Make it executable chmod u+x ops.py
Then execute /ops.py --version
The results is
% ./ops.py --version
{'--help': False,
'--version': True,
'app': False}
dropped:Option('-h', '--help', 0, False, <class 'bool'>, None)
dropped:Option('-v', '--version', 0, False, <class 'bool'>, None)
Traceback (most recent call last):
File "/Users/kevinmueller/projects/shtab-test/./ops.py", line 24, in <module>
parser = argopt(__doc__)
File "/Users/kevinmueller/.pyenv/versions/3.9.7/lib/python3.9/site-packages/argopt/_argopt.py", line 175, in argopt
args, opts = docopt_parser(doc,
File "/Users/kevinmueller/.pyenv/versions/3.9.7/lib/python3.9/site-packages/argopt/_argopt.py", line 89, in docopt_parser
str_pattern = str(pattern)
File "/Users/kevinmueller/.pyenv/versions/3.9.7/lib/python3.9/site-packages/argopt/_docopt.py", line 164, in __repr__
', '.join(repr(a) for a in self.children))
File "/Users/kevinmueller/.pyenv/versions/3.9.7/lib/python3.9/site-packages/argopt/_docopt.py", line 164, in <genexpr>
', '.join(repr(a) for a in self.children))
File "/Users/kevinmueller/.pyenv/versions/3.9.7/lib/python3.9/site-packages/argopt/_docopt.py", line 164, in __repr__
', '.join(repr(a) for a in self.children))
File "/Users/kevinmueller/.pyenv/versions/3.9.7/lib/python3.9/site-packages/argopt/_docopt.py", line 164, in <genexpr>
', '.join(repr(a) for a in self.children))
File "/Users/kevinmueller/.pyenv/versions/3.9.7/lib/python3.9/site-packages/argopt/_docopt.py", line 164, in __repr__
', '.join(repr(a) for a in self.children))
File "/Users/kevinmueller/.pyenv/versions/3.9.7/lib/python3.9/site-packages/argopt/_docopt.py", line 164, in <genexpr>
', '.join(repr(a) for a in self.children))
File "/Users/kevinmueller/.pyenv/versions/3.9.7/lib/python3.9/site-packages/argopt/_docopt.py", line 132, in __repr__
self.value, self.type)
AttributeError: 'Command' object has no attribute 'type'
You can see I'm parsing the doc with docopt and I'm able to print out the options. I may be assuming this is a proper Doc string with this working.
I'm parsing with argopt so I can add tag completion in a zsh environment but I am unable to get past this point.
Requirements.txt
argopt==0.7.0
shtab==1.5.3
docopt==0.6.2
python --version
Python 3.9.7
Thank you in advance for your time.
The text was updated successfully, but these errors were encountered:
I have a basic DocOps string that fails when a command is added.
Here is the script
Make it executable
chmod u+x ops.py
Then execute
/ops.py --version
The results is
You can see I'm parsing the doc with docopt and I'm able to print out the options. I may be assuming this is a proper Doc string with this working.
I'm parsing with argopt so I can add tag completion in a zsh environment but I am unable to get past this point.
Requirements.txt
python --version
Thank you in advance for your time.
The text was updated successfully, but these errors were encountered: