Add 'subparser' snippet.
This commit is contained in:
parent
4d1cb31f48
commit
0d72593ea1
1 changed files with 15 additions and 0 deletions
15
voussoir/argparse_subparser.sublime-snippet
Normal file
15
voussoir/argparse_subparser.sublime-snippet
Normal 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>
|
Loading…
Reference in a new issue