Files
revng-revng/python/revng/internal/cli/_commands/pipeline_tools.py
Giacomo Vercesi 993f66d59c revng cli: drop revng- prefix from libexec
Drop using the `revng-` prefix from all executables under
`libexec/revng/`. Now any executable found under there that is
executable and without extension will be considered a `revng`
subcommand, following the usual command-line rules.
2024-10-01 13:38:14 +02:00

33 lines
1.3 KiB
Python

#
# This file is distributed under the MIT License. See LICENSE.md for details.
#
from revng.internal.cli.commands_registry import Command, CommandsRegistry, Options
from revng.internal.cli.support import build_command_with_loads, interleave, run
from revng.internal.support.collect import collect_pipelines
class PipelineToolCommand(Command):
def __init__(self, name: str, description: str):
super().__init__((name,), description, False)
def register_arguments(self, parser):
pass
def run(self, options: Options):
pipelines = collect_pipelines(options.search_prefixes)
pipelines_args = interleave(pipelines, "-P")
command = build_command_with_loads(
self.name, pipelines_args + options.remaining_args, options
)
return run(command, options)
def setup(commands_registry: CommandsRegistry):
commands_registry.register_command(PipelineToolCommand("artifact", "revng artifact producer"))
commands_registry.register_command(PipelineToolCommand("analyze", "revng analyzer"))
commands_registry.register_command(PipelineToolCommand("invalidate", "revng invalidate"))
commands_registry.register_command(PipelineToolCommand("pipeline", "revng pipeline"))
commands_registry.register_command(PipelineToolCommand("pipe", "revng pipe"))