Skip to content

pr scriptability improvements #1297

Closed

Description

@vilmibm

This issue captures the improvements required to make gh pr subcommands more amenable to scripting. Most of these bullet points are trivial; some are more involved. Came out of research for #940

create:

  • Clear error if not connected to a tty but either --title xor --fill is missing
  • All output except final URL should go to STDERR when when not connected to tty

list:

  • output should be machine friendly when not connected to tty Output should include
    the data that is lost when color is removed.
  • don't print header when not connected to tty

merge:

  • if not tty, merge should run non-interactively.
  • all output should go to STDERR

review:

  • when not connected to tty and there are enough flags, run non-interactively; clear error
    otherwise
  • all output except final review/comment URL should go to STDERR

view:

  • Output raw text and print metadata linewise when not connected to tty

Activity

  1. changed the title [-]pr improvements[/-] [+]pr scriptability improvements[/+] on Jun 30, 2020
  2. mislav commented on Jul 1, 2020

    @mislav
    Contributor

    create:

    • Assume --fill was passed if STDIN fails isTerminal check
    • Assume --fill was passed if STDOUT fails isTerminal check

    I'm wondering whether a safer default behavior would be to, if in non-interactive mode (and thus unable to prompt for information), to fail with an error that explains that either explicit --title or --fill flag is required? That would force scripts that use pr create to read more clearly re: what their intention is.

    In general, the way I see mutation commands such as pr create or repo create is that the API operation that they will result in should be either put behind a prompt confirmation (in interactive mode) or behind an explicit flag (non-interactive mode), but should never be allowed to happen without both.

  3. self-assigned this
    on Jul 9, 2020
  4. vilmibm commented on Jul 9, 2020

    @vilmibm
    ContributorAuthor

    I'm wondering whether a safer default behavior would be to, if in non-interactive mode (and thus unable to prompt for information), to fail with an error that explains that either explicit --title or --fill flag is required? That would force scripts that use pr create to read more clearly re: what their intention is.

    I'm fine with this and mirrors what I did for issue create.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions