From 6455209554e3f551b13852dc0a280508ae4acb86 Mon Sep 17 00:00:00 2001 From: Seppe Stas Date: Tue, 14 May 2019 10:40:50 +0200 Subject: [PATCH] Allow checking multiple specific components using CSV --- schlib/checklib.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/schlib/checklib.py b/schlib/checklib.py index fc721621..b52d38ee 100755 --- a/schlib/checklib.py +++ b/schlib/checklib.py @@ -23,7 +23,7 @@ parser = argparse.ArgumentParser(description='Checks KiCad library files (.lib) against KiCad Library Convention (KLC) rules. You can find the KLC at http://kicad-pcb.org/libraries/klc/') parser.add_argument('libfiles', nargs='+') -parser.add_argument('-c', '--component', help='check only a specific component (implicitly verbose)', action='store') +parser.add_argument('-c', '--component', help='Check only one or more specific component(s) (implicitly verbose). Use comma separated values to select multiple components', action='store') parser.add_argument('-p', '--pattern', help='Check multiple components by matching a regular expression', action='store') parser.add_argument('-r','--rule',help='Select a particular rule (or rules) to check against (default = all rules). Use comma separated values to select multiple rules. e.g. "-r 3.1,EC02"') parser.add_argument('-e','--exclude',help='Exclude a particular rule (or rules) to check against. Use comma separated values to select multiple rules. e.g. "-e 3.1,EC02"') @@ -57,6 +57,11 @@ else: excluded_rules = None +if args.component: + components = args.component.lower().split(',') +else: + components = None + rules = [] for r in all_rules: @@ -105,8 +110,8 @@ #simple match match = True - if args.component: - match = match and args.component.lower() == component.name.lower() + if components: + match = match and component.name.lower() in components #regular expression match if args.pattern: