def shortened_cmd(cmd: str, length: int) ->str:
    """Shorten the command to the specified length."""
    if len(cmd) + 2 <= length:
        return '`' + cmd + '`'
    return '`' + cmd[:length - 5] + '...`'
