From f5df7b4dda33b8e3bdb086b57175d62a5c17f5c3 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 28 Jan 2021 16:52:23 -0800 Subject: [PATCH] Use vlogging's main_fallback name feature in snippets. --- voussoir/argparse.sublime-snippet | 2 +- voussoir/argparse_multi.sublime-snippet | 18 +++++++++--------- voussoir/vlogging.sublime-snippet | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/voussoir/argparse.sublime-snippet b/voussoir/argparse.sublime-snippet index 0101fbc..f364ad5 100644 --- a/voussoir/argparse.sublime-snippet +++ b/voussoir/argparse.sublime-snippet @@ -5,7 +5,7 @@ import sys from voussoirkit import vlogging -log = vlogging.getLogger(__name__) +log = vlogging.getLogger(__name__, '$1') def $1_argparse(args): return $1() diff --git a/voussoir/argparse_multi.sublime-snippet b/voussoir/argparse_multi.sublime-snippet index 1e46e24..9041a67 100644 --- a/voussoir/argparse_multi.sublime-snippet +++ b/voussoir/argparse_multi.sublime-snippet @@ -5,10 +5,10 @@ import sys from voussoirkit import vlogging -log = vlogging.getLogger(__name__) +log = vlogging.getLogger(__name__, '$1') -def $1_argparse(args): - return $1() +def $2_argparse(args): + return $2() def main(argv): argv = vlogging.set_level_by_argv(log, argv) @@ -16,12 +16,12 @@ def main(argv): parser = argparse.ArgumentParser(description=__doc__) subparsers = parser.add_subparsers() - 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) + p_$2 = subparsers.add_parser('$2') + p_$2.add_argument('required_positional') + p_$2.add_argument('optional_positional', nargs='?', default=None) + p_$2.add_argument('-k', '--kwarg', dest='kwarg', default=None) + p_$2.add_argument('-b', '--boolkwarg', dest='boolkwarg', action='store_true') + p_$2.set_defaults(func=$2_argparse) args = parser.parse_args(argv) return args.func(args) diff --git a/voussoir/vlogging.sublime-snippet b/voussoir/vlogging.sublime-snippet index e07068c..29a2021 100644 --- a/voussoir/vlogging.sublime-snippet +++ b/voussoir/vlogging.sublime-snippet @@ -2,7 +2,7 @@