diff --git a/README.md b/README.md index 5ccc2dd..ebb3e05 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,12 @@ if you put this in pyproject.toml: ```toml [tool.bork.aliases] # Runs *only* pylint. (Not the actual tests.) -lint = "pytest -k 'pylint' --pylint --verbose" +lint = [ + # Runs *only* pylint. (Not the actual tests.) + "pytest -k 'pylint' --pylint --verbose", + # Typecheck the project + "mypy .", +] # Runs tests and pylint. test = "pytest --pylint --verbose" test-only = "pytest --verbose" diff --git a/bork/api.py b/bork/api.py index 29672bc..2a28da1 100644 --- a/bork/api.py +++ b/bork/api.py @@ -105,14 +105,23 @@ def run(alias): pyproject = toml.load('pyproject.toml') try: - command = pyproject['tool']['bork']['aliases'][alias] + commands = pyproject['tool']['bork']['aliases'][alias] except KeyError as error: raise RuntimeError("No such alias: '{}'".format(alias)) from error - logger().info("Running '%s'", command) + logger().info("Running '%s'", commands) + + if isinstance(commands, str): + commands = [commands] + elif isinstance(commands, list): + pass + else: + raise TypeError(f"commands must be str or list, was {type(commands)}") try: - subprocess.run(command, check=True, shell=True) + for command in commands: + print(command) + subprocess.run(command, check=True, shell=True) except subprocess.CalledProcessError as error: if error.returncode < 0: