~aperezdc/webkit-releng-toolbelt

ebdb951789b668d665787cacb8b9af2d62e50e46 — Adrian Perez de Castro 5 years ago 93b71c6
generate: Support a -v/--verbose command line flag

Make the "generate" subcommand accept "-v" (or "--verbose"), which
will display each generated file path if a configuration item from
the "files" section is not specified.
1 files changed, 4 insertions(+), 2 deletions(-)

M wkrel/commands.py
M wkrel/commands.py => wkrel/commands.py +4 -2
@@ 80,9 80,9 @@ class cmd_generate(Command):
    """
    aliases = ("gen",)
    takes_args = ("tarball", "item?")
    takes_options = (opt_config_dir,)
    takes_options = (opt_config_dir, opt_verbose)

    def run(self, tarball, item=None, config_dir=None):
    def run(self, tarball, item=None, config_dir=None, verbose=False):
        tar = Path(tarball)
        if not tar.is_file():
            raise SystemExit("Not a file: {!s}".format(tarball))


@@ 100,6 100,8 @@ class cmd_generate(Command):
        for name in release.config.files.keys():
            suffix = release.file.path.suffix + "." + name
            outpath = release.file.path.with_suffix(suffix)
            if verbose:
                print("Generating:", outpath)
            outpath.write_text(release.render_item(name), encoding="utf-8")