Last active
October 7, 2015 23:35
-
-
Save chrisb13/a1e813302a0c9fbd9759 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet docopt | |
#see: https://github.com/docopt/docopt | |
#round brackets mean required square are optional | |
#download docopt from... | |
#https://raw.githubusercontent.com/docopt/docopt/master/docopt.py | |
`!p | |
import inspect,os | |
docopt_path=os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))+'/docopt.py' | |
#snip.rv=docopt_path | |
if not os.path.isfile(docopt_path): | |
import urllib | |
urllib.urlretrieve("https://raw.githubusercontent.com/docopt/docopt/master/docopt.py",\ | |
filename=docopt_path) | |
#ret='downloaded docopt' | |
#else: | |
#ret='did not download docopt' | |
#snip.rv=ret | |
` | |
""" | |
${1:Docstring for file} | |
Usage: | |
`!p | |
snip.rv=' '+snip.fn | |
` -h | |
`!p | |
snip.rv=' '+snip.fn | |
` ( ${2:first_argument} | ${4:second_argument} ) | |
Options: | |
-h,--help : show this help message | |
$2,--${3:Long_version_first_agument} : optional argument | |
$4 : mandatory argument (capitals or angled brackets) | |
""" | |
from docopt import docopt | |
arguments = docopt(__doc__) | |
endsnippet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment