def generate_command()

in scripts/local_cloudbuild.py [0:0]


def generate_command(step, substitutions, substitutions_used):
    """Generate a single shell command to run for a single cloudbuild step

    Args:
        step (Step): Valid build step
        subs (dict): Substitution map to apply
        subs_used (set): Updated with names from `subs.keys()` when those
                         substitutions are encountered in an element of `step`

    Returns:
        [str]: A single shell command, expressed as a list of quoted tokens.
    """
    quoted_args = [sub_and_quote(arg, substitutions, substitutions_used)
                   for arg in step.args]
    quoted_env = []
    for env in step.env:
        quoted_env.extend(['--env', sub_and_quote(env, substitutions,
                                                  substitutions_used)])
    quoted_name = sub_and_quote(step.name, substitutions, substitutions_used)
    workdir = '/workspace'
    if step.dir_:
        workdir = os.path.join(workdir, sub_and_quote(step.dir_, substitutions,
                                                      substitutions_used))
    process_args = [
        'docker',
        'run',
        '--volume',
        '/var/run/docker.sock:/var/run/docker.sock',
        '--volume',
        '/root/.docker:/root/.docker',
        '--volume',
        '${HOST_WORKSPACE}:/workspace',
        '--workdir',
        workdir,
    ] + quoted_env + [quoted_name] + quoted_args
    return process_args