Add 'subparser' snippet.

This commit is contained in:
Ethan Dalool 2020-10-30 18:55:09 -07:00
parent 4d1cb31f48
commit 0d72593ea1

View file

@ -0,0 +1,15 @@
<snippet>
<content><![CDATA[
p_$1 = subparsers.add_parser('$1')
p_$1.add_argument('required_positional')
p_$1.add_argument('optional_positional', nargs='?', default=None)
p_$1.add_argument('-k', '--kwarg', dest='kwarg', default=None)
p_$1.add_argument('-b', '--boolkwarg', dest='boolkwarg', action='store_true')
p_$1.set_defaults(func=$1_argparse)
]]></content>
<tabTrigger>subparser</tabTrigger>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>