Fix some boilerplate snippets.

This commit is contained in:
voussoir 2021-05-26 21:38:01 -07:00
parent 77349d63a8
commit 568323bbc9
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 6 additions and 3 deletions

View file

@ -15,8 +15,9 @@ def main(argv):
parser.add_argument('--boolkwarg', action='store_true') parser.add_argument('--boolkwarg', action='store_true')
parser.set_defaults(func=$1_argparse) parser.set_defaults(func=$1_argparse)
args = parser.parse_args(argv) with opnot_context:
args.func(args) args = parser.parse_args(argv)
return args.func(args)
]]></content> ]]></content>
<tabTrigger>argparse</tabTrigger> <tabTrigger>argparse</tabTrigger>

View file

@ -1,8 +1,10 @@
<snippet> <snippet>
<content><![CDATA[ <content><![CDATA[
'''
from voussoirkit import betterhelp from voussoirkit import betterhelp
# replace the following lines:
# args = parser.parse_args(argv)
# return args.func(args)
return betterhelp.single_main(argv, parser, __doc__) return betterhelp.single_main(argv, parser, __doc__)
]]></content> ]]></content>
<tabTrigger>betterhelp</tabTrigger> <tabTrigger>betterhelp</tabTrigger>