diff --git a/yamlfixer/__main__.py b/yamlfixer/__main__.py index 9cc97a8..966134d 100755 --- a/yamlfixer/__main__.py +++ b/yamlfixer/__main__.py @@ -63,9 +63,9 @@ def run(): cmdline.add_argument("-d", "--debug", action="store_true", help="output debug information to stderr.") - cmdline.add_argument("-l", "--listfixes", + cmdline.add_argument("-l", "--listfixers", action="store_true", - help="output the list of available fixes.") + help="output the list of available fixers.") mutuallyexclusive = cmdline.add_mutually_exclusive_group() mutuallyexclusive.add_argument("-j", "--jsonsummary", action="store_true", @@ -90,9 +90,10 @@ def run(): if cmdline.prog == "__main__.py": cmdline.prog = "yamlfixer" arguments = cmdline.parse_args() - if arguments.listfixes: - return YAMLFixer(arguments).listfixes() - return YAMLFixer(arguments).fix() + yfixer = YAMLFixer(arguments) + if arguments.listfixers: + return yfixer.listfixers() + return yfixer.fix() if __name__ == '__main__': sys.exit(run()) diff --git a/yamlfixer/yamlfixer.py b/yamlfixer/yamlfixer.py index badb93a..0808449 100755 --- a/yamlfixer/yamlfixer.py +++ b/yamlfixer/yamlfixer.py @@ -89,16 +89,16 @@ def statistics(self): } self.info(json.dumps(summarymapping, indent=4)) - def listfixes(self): - """List all the available fixes.""" - availablefixes = [] + def listfixers(self): + """List all the available fixers.""" + availablefixers = [] for methodname in [m for m in dir(ProblemFixer) if m.startswith('fix_')]: docstring = getattr(ProblemFixer, methodname).__doc__ for prob in [pb.strip()[2:] for pb in docstring.splitlines()[1:]]: if prob: - availablefixes.append(prob) - self.info("fixes:") - for fixstr in sorted(availablefixes): + availablefixers.append(prob) + self.info("fixers:") + for fixstr in sorted(availablefixers): self.info(f" - {fixstr}") return EXIT_OK