Output Formats
Control how the CLI renders command results with TTY-aware defaults and multiple output formats.The App Store Connect CLI supports multiple output formats and automatically adapts to your environment.
Format Options
All commands that return data support three output formats:json- Machine-parseable JSON (default for non-interactive contexts)table- Human-readable table (default for interactive terminals)markdown- Markdown-formatted tables
TTY-Aware Defaults
The CLI automatically detects whether it’s running in an interactive terminal:Explicit Format Selection
Override the default with the--output flag:
Environment Variable
Set a default format across all commands withASC_DEFAULT_OUTPUT:
json, table, markdown, md
The
--output flag always takes precedence over ASC_DEFAULT_OUTPUT and TTY detection.Pretty-Printing JSON
For human-readable JSON output, use the--pretty flag:
Format Examples
Table Format
JSON Format
Markdown Format
Implementation Details
Output format resolution follows this priority order:- Explicit
--outputflag (highest priority) ASC_DEFAULT_OUTPUTenvironment variable- TTY detection (lowest priority)
- TTY detected →
table - No TTY →
json
- TTY detected →
term.IsTerminal() to check stdout’s file descriptor. This works correctly with:
- Pipes:
asc apps list | jq - Redirects:
asc apps list > output.json - CI environments: GitHub Actions, GitLab CI, Jenkins
- Docker containers (non-interactive)
Format Registry
The CLI uses a type-safe output registry system (internal/asc/output_registry.go) that maps response types to rendering functions. This ensures:
- Consistent formatting across all commands
- Type-safe row extraction
- Automatic handling of single vs. list responses
Best Practices
In Scripts
Always use
--output json for reliability and parsing.In CI/CD
The CLI defaults to JSON automatically in non-interactive environments.
For Debugging
Use
--output json --pretty to inspect API responses.For Reports
Use
--output markdown to generate documentation snippets.Related
- Pagination - How output formats interact with paginated results
- Error Handling - Error messages always go to stderr