diff --git a/voussoir/argparse.sublime-snippet b/voussoir/argparse.sublime-snippet index 3c9898a..e7413b5 100644 --- a/voussoir/argparse.sublime-snippet +++ b/voussoir/argparse.sublime-snippet @@ -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) ]]> argparse diff --git a/voussoir/boilerplate_multi.sublime-snippet b/voussoir/boilerplate_multi.sublime-snippet index 4b714cb..47b1ba9 100644 --- a/voussoir/boilerplate_multi.sublime-snippet +++ b/voussoir/boilerplate_multi.sublime-snippet @@ -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:])) diff --git a/voussoir/boilerplate_single.sublime-snippet b/voussoir/boilerplate_single.sublime-snippet index 231328c..08afe61 100644 --- a/voussoir/boilerplate_single.sublime-snippet +++ b/voussoir/boilerplate_single.sublime-snippet @@ -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:])) diff --git a/voussoir/on_pageload.sublime-snippet b/voussoir/on_pageload.sublime-snippet new file mode 100644 index 0000000..84d4f11 --- /dev/null +++ b/voussoir/on_pageload.sublime-snippet @@ -0,0 +1,9 @@ + + + on_pageload + diff --git a/voussoir/operatornotify_mainlog.sublime-snippet b/voussoir/operatornotify_mainlog.sublime-snippet index d9ff077..bad2886 100644 --- a/voussoir/operatornotify_mainlog.sublime-snippet +++ b/voussoir/operatornotify_mainlog.sublime-snippet @@ -1,8 +1,9 @@ operatornotify_mainlog source.python diff --git a/voussoir/vlogging.sublime-snippet b/voussoir/vlogging.sublime-snippet index f29b9e2..a3030b1 100644 --- a/voussoir/vlogging.sublime-snippet +++ b/voussoir/vlogging.sublime-snippet @@ -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 ]]> vlogging source.python