Update boilerplate snippets.
This commit is contained in:
parent
bc45143dbf
commit
42c784ada6
5 changed files with 35 additions and 3 deletions
24
voussoir/argparse.sublime-snippet
Normal file
24
voussoir/argparse.sublime-snippet
Normal 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>
|
10
voussoir/betterhelp.sublime-snippet
Normal file
10
voussoir/betterhelp.sublime-snippet
Normal 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>
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue