INNER CODE UNIT · Python

cli_command

renezander030/capcut-cli · python/capcut/__init__.py:113

def cli_command() -> List[str]:
    """The argv prefix that runs capcut-cli: ``CAPCUT_CLI`` split like a shell would, else ``capcut`` on PATH."""
    configured = os.environ.get("CAPCUT_CLI", "").strip()
    if configured:
        return shlex.split(configured, posix=(os.name != "nt"))
    found = shutil.which("capcut")
    if found:
        return [found]
    raise CliNotFound(INSTALL_HINT)


def flag_args(flags: Mapping[str, Any]) -> List[str]:
    """``{"font_size": 16, "karaoke": True, "tag": ["a", "b"]}`` → ``["--font-size", "16", "--karaoke", "--tag", "a", "--tag", "b"]``."""
    out: List[str] = []
    for key, value in flags.items():
        flag = "--" + key.replace("_", "-")
        if value is None or value is False:
            continue

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…