From: Scott Worley Date: Sun, 12 Apr 2020 16:54:57 +0000 (-0700) Subject: Specify channels to pin on command line X-Git-Tag: 1.1 X-Git-Url: http://git.scottworley.com/pinch/commitdiff_plain/988531533047eac7a381e103cb59301ec165de0e?hp=4fdb3625fc47889c73bb4af21da1a67dcb185a65 Specify channels to pin on command line No specified channels -> pin all channels (which is an unfortunate interface for scripting. Sorry). --- diff --git a/pinch.py b/pinch.py index 6bd7dd3..8bda816 100644 --- a/pinch.py +++ b/pinch.py @@ -458,6 +458,8 @@ def pin(args: argparse.Namespace) -> None: config = configparser.ConfigParser() config.read_file(open(args.channels_file), args.channels_file) for section in config.sections(): + if args.channels and section not in args.channels: + continue channel = Channel(**dict(config[section].items())) if hasattr(channel, 'git_revision'): @@ -516,6 +518,7 @@ def main() -> None: subparsers = parser.add_subparsers(dest='mode', required=True) parser_pin = subparsers.add_parser('pin') parser_pin.add_argument('channels_file', type=str) + parser_pin.add_argument('channels', type=str, nargs='*') parser_pin.set_defaults(func=pin) parser_update = subparsers.add_parser('update') parser_update.add_argument('channels_file', type=str)