Skip to content

Feature request: Auto-detect TTY for --output default across all deadline CLI commands #1130

@crowecawcaw

Description

@crowecawcaw

Describe the problem

The deadline CLI has seven subcommands that accept an --output flag (job wait, job logs, bundle submit, bundle gui-submit, bundle run, auth status, config show). They all default to a human-readable format (verbose or text).

This is the right default for a human at a terminal, but the wrong default for the two largest non-human audiences:

  1. AI agents and scripts invoking the CLI to parse its output. They have to remember to pass --output json on every call, or build a wrapper.
  2. Pipelines and redirection like deadline job logs --job-id … > out.txt, where the human writer is no longer the reader.

The current situation also forces agent-oriented docs and tools to repeat --output json everywhere, which is boilerplate that the CLI should handle itself.

Proposed Solution

When --output is not specified, detect whether stdout is a TTY and default to json when it is not. Humans at a terminal keep today's human-readable output; agents, pipes, and CI get JSON automatically. Explicit --output values always win.

Prior art for this pattern:

Example Use Cases

Agent invocation becomes boilerplate-free.

Before:

deadline bundle run ./my_bundle --output json -q
deadline job logs --job-id "$JOB_ID" --output json
deadline job wait --job-id "$JOB_ID" --output json

After:

deadline bundle run ./my_bundle
deadline job logs --job-id "$JOB_ID"
deadline job wait --job-id "$JOB_ID"

Humans keep the readable output with no change. Running any of these commands in a terminal still prints the human format.

CI or container jobs without a TTY get JSON for free:

- name: Wait for job
  run: deadline job wait --job-id ${{ steps.submit.outputs.job-id }}

Opt-out for edge cases. A script that wants human output despite being non-interactive can pass --output verbose; a human who wants JSON in a terminal can pass --output json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions