Update boilerplate snippets.

This commit is contained in:
voussoir 2021-05-14 17:56:43 -07:00
parent bc45143dbf
commit 42c784ada6
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
5 changed files with 35 additions and 3 deletions

View file

@ -0,0 +1,24 @@
<snippet>
<content><![CDATA[
def $1_argparse(args):
return 0
def main(argv):
argv = vlogging.set_level_by_argv(log, argv)
(opnot_context, argv) = operatornotify.main_log_context(argv, subject='$1 warnings')
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)
args = parser.parse_args(argv)
args.func(args)
]]></content>
<tabTrigger>argparse</tabTrigger>
<scope>source.python</scope>
</snippet>

View file

@ -0,0 +1,10 @@
<snippet>
<content><![CDATA[
'''
from voussoirkit import betterhelp
return betterhelp.single_main(argv, parser, __doc__)
]]></content>
<tabTrigger>betterhelp</tabTrigger>
<scope>source.python</scope>
</snippet>

View file

@ -53,5 +53,4 @@ if __name__ == '__main__':
]]></content> ]]></content>
<tabTrigger>boilerplate_multi</tabTrigger> <tabTrigger>boilerplate_multi</tabTrigger>
<scope>source.python</scope> <scope>source.python</scope>
<description>boilerplate multi</description>
</snippet> </snippet>

View file

@ -37,5 +37,4 @@ if __name__ == '__main__':
]]></content> ]]></content>
<tabTrigger>boilerplate</tabTrigger> <tabTrigger>boilerplate</tabTrigger>
<scope>source.python</scope> <scope>source.python</scope>
<description>boilerplate single</description>
</snippet> </snippet>

View file

@ -1,7 +1,7 @@
<snippet> <snippet>
<content><![CDATA[ <content><![CDATA[
from voussoirkit import operatornotify from voussoirkit import operatornotify
(notify_context, argv) = operatornotify.main_log_context(argv, subject='$1 warnings') (notify_context, argv) = operatornotify.main_log_context(argv, subject='$1.py')
with notify_context: with notify_context:
]]></content> ]]></content>
<tabTrigger>operatornotify_mainlog</tabTrigger> <tabTrigger>operatornotify_mainlog</tabTrigger>