Update snippets.
This commit is contained in:
parent
b78fb6bff8
commit
aa816f38e6
6 changed files with 25 additions and 21 deletions
|
@ -3,10 +3,9 @@
|
||||||
def $1_argparse(args):
|
def $1_argparse(args):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@operatornotify.main_decorator('$1')
|
||||||
|
@vlogging.main_decorator
|
||||||
def main(argv):
|
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 = argparse.ArgumentParser(description=__doc__)
|
||||||
|
|
||||||
parser.add_argument('required_positional')
|
parser.add_argument('required_positional')
|
||||||
|
@ -15,9 +14,8 @@ def main(argv):
|
||||||
parser.add_argument('--boolkwarg', action='store_true')
|
parser.add_argument('--boolkwarg', action='store_true')
|
||||||
parser.set_defaults(func=$1_argparse)
|
parser.set_defaults(func=$1_argparse)
|
||||||
|
|
||||||
with opnot_context:
|
args = parser.parse_args(argv)
|
||||||
args = parser.parse_args(argv)
|
return args.func(args)
|
||||||
return args.func(args)
|
|
||||||
|
|
||||||
]]></content>
|
]]></content>
|
||||||
<tabTrigger>argparse</tabTrigger>
|
<tabTrigger>argparse</tabTrigger>
|
||||||
|
|
|
@ -30,10 +30,10 @@ def $2_argparse(args):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
__doc__ = betterhelp.add_previews(__doc__, SUB_DOCSTRINGS)
|
__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__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
subparsers = parser.add_subparsers()
|
subparsers = parser.add_subparsers()
|
||||||
|
|
||||||
|
@ -44,8 +44,7 @@ def main(argv):
|
||||||
p_$2.add_argument('--boolkwarg', action='store_true')
|
p_$2.add_argument('--boolkwarg', action='store_true')
|
||||||
p_$2.set_defaults(func=$2_argparse)
|
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__':
|
if __name__ == '__main__':
|
||||||
raise SystemExit(main(sys.argv[1:]))
|
raise SystemExit(main(sys.argv[1:]))
|
||||||
|
|
|
@ -16,10 +16,9 @@ log = vlogging.getLogger(__name__, '$1')
|
||||||
def $1_argparse(args):
|
def $1_argparse(args):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@operatornotify.main_decorator('$1')
|
||||||
|
@vlogging.main_decorator
|
||||||
def main(argv):
|
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 = argparse.ArgumentParser(description=__doc__)
|
||||||
|
|
||||||
parser.add_argument('required_positional')
|
parser.add_argument('required_positional')
|
||||||
|
@ -28,8 +27,7 @@ def main(argv):
|
||||||
parser.add_argument('--boolkwarg', action='store_true')
|
parser.add_argument('--boolkwarg', action='store_true')
|
||||||
parser.set_defaults(func=$1_argparse)
|
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__':
|
if __name__ == '__main__':
|
||||||
raise SystemExit(main(sys.argv[1:]))
|
raise SystemExit(main(sys.argv[1:]))
|
||||||
|
|
9
voussoir/on_pageload.sublime-snippet
Normal file
9
voussoir/on_pageload.sublime-snippet
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<snippet>
|
||||||
|
<content><![CDATA[
|
||||||
|
function on_pageload()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
document.addEventListener("DOMContentLoaded", on_pageload);
|
||||||
|
]]></content>
|
||||||
|
<tabTrigger>on_pageload</tabTrigger>
|
||||||
|
</snippet>
|
|
@ -1,8 +1,9 @@
|
||||||
<snippet>
|
<snippet>
|
||||||
<content><![CDATA[
|
<content><![CDATA[
|
||||||
from voussoirkit import operatornotify
|
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>
|
]]></content>
|
||||||
<tabTrigger>operatornotify_mainlog</tabTrigger>
|
<tabTrigger>operatornotify_mainlog</tabTrigger>
|
||||||
<scope>source.python</scope>
|
<scope>source.python</scope>
|
||||||
|
|
|
@ -4,9 +4,8 @@ from voussoirkit import vlogging
|
||||||
|
|
||||||
log = vlogging.getLogger(__name__, '$1')
|
log = vlogging.getLogger(__name__, '$1')
|
||||||
|
|
||||||
# Put this at the top of main
|
# Put this above main
|
||||||
argv = vlogging.main_level_by_argv(argv)
|
@vlogging.main_decorator
|
||||||
|
|
||||||
]]></content>
|
]]></content>
|
||||||
<tabTrigger>vlogging</tabTrigger>
|
<tabTrigger>vlogging</tabTrigger>
|
||||||
<scope>source.python</scope>
|
<scope>source.python</scope>
|
||||||
|
|
Loading…
Reference in a new issue