Add a command line option to run nvchecker only on a specific entry

This is useful for debugging purpose, when your nvchecker.toml is very
large.
This commit is contained in:
Felix Yan 2020-11-17 06:34:53 +08:00
parent e5a28b0fb1
commit e6c0ce38e5
No known key found for this signature in database
GPG Key ID: 786C63F330D7CB92

View File

@ -25,6 +25,8 @@ def main() -> None:
help='use specified keyfile (override the one in configuration file)')
parser.add_argument('-t', '--tries', default=1, type=int, metavar='N',
help='try N times when network errors occur')
parser.add_argument('-e', '--entry', type=str,
help='only execute on specified entry (useful for debugging)')
core.add_common_arguments(parser)
args = parser.parse_args()
if core.process_common_arguments(args):
@ -34,6 +36,11 @@ def main() -> None:
entries, options = core.load_file(
args.file, use_keymanager=not bool(args.keyfile))
if args.entry:
if args.entry not in entries:
sys.exit('Specified entry not found in config')
entries = {args.entry: entries[args.entry]}
if args.keyfile:
keymanager = KeyManager(Path(args.keyfile))
else: