jw.pkg.lib.util.run_cmd(): Add title parameter

Allow the caller to choose which title should be used for the
command's logging output box.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-02-18 10:59:22 +01:00
commit 75faf02232

View file

@ -31,7 +31,8 @@ async def run_cmd(
throw: bool = True,
verbose: bool = False,
cmd_input: str|None = None,
env: dict[str, str] | None = None
env: dict[str, str] | None = None,
title: str=None
) -> tuple[str|None, str|None]:
"""
Run a command asynchronously and return its output
@ -75,7 +76,7 @@ async def run_cmd(
if verbose:
delim_len = 120
delim = f'---- running {pretty_cmd(args, wd)} -'
delim = title if title is not None else f'---- Running {pretty_cmd(args, wd)} -'
delim += '-' * max(0, delim_len - len(delim))
log(NOTICE, ',' + delim + ' >')