Skip to content

gh gist view and gh gist edit prompts with no TTY #10042

@BagToad

Description

@BagToad

Describe the bug

gh gist view and gh gist edit attempt to prompt when no TTY is available, but it should not.

It should behave more like gh run view, for example:

Example `gh run view` behavior with no TTY

❯ gh run view | cat  
run or job ID required when not running interactively

Usage:  gh run view [<run-id>] [flags]

Flags:
  -a, --attempt uint      The attempt number of the workflow run
      --exit-status       Exit with non-zero status if run failed
  -j, --job string        View a specific job ID from a run
  -q, --jq expression     Filter JSON output using a jq expression
      --json fields       Output JSON with the specified fields
      --log               View full log for either a run or specific job
      --log-failed        View the log for any failed steps in a run or specific job
  -t, --template string   Format JSON output using a Go template; see "gh help formatting"
  -v, --verbose           Show job steps
  -w, --web               Open run in the browser
  

Steps to reproduce the behavior

gh gist view | cat

Expected vs actual behavior

Expected: gh gist view and gh gist edit should return an error & "help" output if no TTY is available when it would otherwise prompt.
Actual: gh gist view and gh gist edit attempts to prompt the user

Logs

❯ gh gist view | cat
? Select a gist  [Use arrows to move, type to filter]
> test.md test gist about 19 hours ago
  draft.md  about 2 months ago

Metadata

Metadata

Labels

bugSomething isn't workinggh-gistrelating to the gh gist commandhelp wantedContributions welcome

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions