Update snippets.

This commit is contained in:
voussoir 2021-06-21 23:06:35 -07:00
parent b78fb6bff8
commit aa816f38e6
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
6 changed files with 25 additions and 21 deletions

View file

@ -3,10 +3,9 @@
def $1_argparse(args):
return 0
@operatornotify.main_decorator('$1')
@vlogging.main_decorator
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')
@ -15,9 +14,8 @@ def main(argv):
parser.add_argument('--boolkwarg', action='store_true')
parser.set_defaults(func=$1_argparse)
with opnot_context:
args = parser.parse_args(argv)
return args.func(args)
args = parser.parse_args(argv)
return args.func(args)
]]></content>
<tabTrigger>argparse</tabTrigger>

View file

@ -30,10 +30,10 @@ def $2_argparse(args):
return 0
__doc__ = betterhelp.add_previews(__doc__, SUB_DOCSTRINGS)
def main(argv):
argv = vlogging.set_level_by_argv(log, argv)
(opnot_context, argv) = operatornotify.main_log_context(argv, subject='$1 warnings')
@operatornotify.main_decorator('$1')
@vlogging.main_decorator
def main(argv):
parser = argparse.ArgumentParser(description=__doc__)
subparsers = parser.add_subparsers()
@ -44,8 +44,7 @@ def main(argv):
p_$2.add_argument('--boolkwarg', action='store_true')
p_$2.set_defaults(func=$2_argparse)
with opnot_context:
return betterhelp.subparser_main(argv, parser, __doc__, SUB_DOCSTRINGS)
return betterhelp.subparser_main(argv, parser, __doc__, SUB_DOCSTRINGS)
if __name__ == '__main__':
raise SystemExit(main(sys.argv[1:]))

View file

@ -16,10 +16,9 @@ log = vlogging.getLogger(__name__, '$1')
def $1_argparse(args):
return 0
@operatornotify.main_decorator('$1')
@vlogging.main_decorator
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')
@ -28,8 +27,7 @@ def main(argv):
parser.add_argument('--boolkwarg', action='store_true')
parser.set_defaults(func=$1_argparse)
with opnot_context:
return betterhelp.single_main(argv, parser, __doc__)
return betterhelp.single_main(argv, parser, __doc__)
if __name__ == '__main__':
raise SystemExit(main(sys.argv[1:]))

View file

@ -0,0 +1,9 @@
<snippet>
<content><![CDATA[
function on_pageload()
{
}
document.addEventListener("DOMContentLoaded", on_pageload);
]]></content>
<tabTrigger>on_pageload</tabTrigger>
</snippet>

View file

@ -1,8 +1,9 @@
<snippet>
<content><![CDATA[
from voussoirkit import operatornotify
(notify_context, argv) = operatornotify.main_log_context(argv, subject='$1.py')
with notify_context:
# Put this above main
@operatornotify.main_decorator('$1')
]]></content>
<tabTrigger>operatornotify_mainlog</tabTrigger>
<scope>source.python</scope>

View file

@ -4,9 +4,8 @@ from voussoirkit import vlogging
log = vlogging.getLogger(__name__, '$1')
# Put this at the top of main
argv = vlogging.main_level_by_argv(argv)
# Put this above main
@vlogging.main_decorator
]]></content>
<tabTrigger>vlogging</tabTrigger>
<scope>source.python</scope>