sublime/voussoir/boilerplate_single.sublime-snippet
2021-06-21 23:06:35 -07:00

38 lines
900 B
XML

<snippet>
<content><![CDATA[
'''
$1
======
'''
import argparse
import sys
from voussoirkit import betterhelp
from voussoirkit import operatornotify
from voussoirkit import vlogging
log = vlogging.getLogger(__name__, '$1')
def $1_argparse(args):
return 0
@operatornotify.main_decorator('$1')
@vlogging.main_decorator
def main(argv):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('required_positional')
parser.add_argument('optional_positional', nargs='?', default=None)
parser.add_argument('--kwarg', default=None)
parser.add_argument('--boolkwarg', action='store_true')
parser.set_defaults(func=$1_argparse)
return betterhelp.single_main(argv, parser, __doc__)
if __name__ == '__main__':
raise SystemExit(main(sys.argv[1:]))
]]></content>
<tabTrigger>boilerplate</tabTrigger>
<scope>source.python</scope>
</snippet>