Scriptability audit
This document acts as a high level TODO list for improving scriptability of gh across all of our
commands.
gh pr
create
close
checkout
diff
list
merge
ready
reopen
review
status
view
gh issue
close
create
list
reopen
status
view
gh repo
clone
create
fork
view
gh alias
delete
list
set
gh api
gh config
set
get
gh gist
create
Scriptability audit
This document acts as a high level TODO list for improving scriptability of
ghacross all of ourcommands.
gh pr
create
Behavior when
STDINis a pipeCurrent: It breaks. Because STDIN is occupied, survey fails to prompt.
Desired: It doesn't break. It'd be cool if we could take PR data to pre-fill the prompts with
but that opens up questions of how to serialize the input. For now it should just behave as if
--fill was passed.
Behavior when
STDOUTis piped outCurrent: It breaks. survey writes to the pipe and the command hangs indefinitely.
Desired: It doesn't break. --fill should be assumed since it's impossible to prompt.
Behavior when run un-attached to a terminal
Current: It hangs still attempting to prompt.
Desired: --fill should be assumed.
Consistent use of
STDERRCurrent: Almost all output in the non-interactive case goes to STDERR.
Desired: All output except the final PR URL is sent to STDERR in the non-interactive case.
close
Behavior when
STDINis piped to commandCurrent: Argument validation error.
Desired: STDIN should be parsed as a single PR argument.
Behavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Consistent use of
STDERRcheckout
Behavior when
STDINis piped to commandCurrent: Validation error
Desired: STDIN parsed as a single PR argument
Behavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Consistent use of
STDERRdiff
Behavior when
STDINis piped to commandCurrent: STDIN is ignored and current branch's PR is used, if any.
Desired: STDIN is parsed as a single PR argument
Behavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Consistent use of
STDERRlist
Behavior when
STDINis piped to commandBehavior when
STDOUTis piped outCurrent: Just the PR list is printed in a slightly different format
Desired: The format is more machine-friendly and conveys what is lost without color. It should
be easy to process with
cutorawk.Behavior when run un-attached to a terminal
Consistent use of
STDERRCurrent: "Showing x of y pull requests in owner/repo" is always printed to STDERR
Desired: Nothing is printed to STDERR (except warnings/errors) if running non-interactively
merge
Behavior when
STDINis piped to commandCurrent: Broken. Survey tries and fails to prompt user.
Desired: If a pipe, STDIN should be parsed as a single PR argument and then the merge should run
non-interactively.
Behavior when
STDOUTis piped outCurrent: Broken. Survey hangs forever.
Desired: Non-interactive is assumed.
Behavior when run un-attached to a terminal
Current: Broken.
Desired: Non-interactive is assumed.
Consistent use of
STDERRCurrent: All output goes to STDOUT
Desired: Output should go to STDERR
ready
Behavior when
STDINis piped to commandCurrent: STDIN is ignored
Desired: STDIN is parsed as a single PR argument.
Behavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Consistent use of
STDERRreopen
Behavior when
STDINis piped to commandCurrent: Validation error
Desired: STDIN is parsed as a single PR argument.
Behavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Consistent use of
STDERRreview
Behavior when
STDINis piped to commandCurrent: STDIN is ignored
Desired: STDIN is parsed as a single PR argument.
Behavior when
STDOUTis piped outCurrent: Hangs waiting for input.
Desired: If lacking enough flags to run non-interactively, clear error. Otherwise just run.
Behavior when run un-attached to a terminal
Consistent use of
STDERRCurrent: Outputs everything to STDOUT
Desired: Should send current output to STDERR but print URL of review/comment to STDOUT
status
Behavior when
STDINis piped to commandBehavior when
STDOUTis piped outCurrent: Same human-oriented output is printed
Desired:
grep/awk/cutfriendly outputBehavior when run un-attached to a terminal
Consistent use of
STDERRview
Behavior when
STDINis piped to commandCurrent: Ignored
Desired: STDIN parsed as single PR argument
Behavior when
STDOUTis piped outCurrent: Rendered markdown and human metadata written to pipe
Desired: Raw markdown is printed, possibly made possible via a --raw flag. Metadata printed
linewise for grepping.
Behavior when run un-attached to a terminal
Consistent use of
STDERRgh issue
close
Behavior when
STDINis piped to commandCurrent: Argument validation error.
Desired: STDIN should be parsed as a single PR argument.
Behavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Consistent use of
STDERRcreate
Behavior when
STDINis piped to commandCurrent: Breaks. Survey attempts to parse STDIN.
Desired: Doesn't break but errors clearly saying that piping on STDIN is unsupported
Behavior when
STDOUTis piped outCurrent: Hangs. Survey writing to pipe.
Desired: Clear error
Behavior when run un-attached to a terminal
Current: Hangs.
Desired: Clear error
Consistent use of
STDERRlist
Behavior when
STDINis piped to commandBehavior when
STDOUTis piped outCurrent: Just the issue list is printed in a slightly different format
Desired: The format is more machine-friendly and conveys what is lost without color. It should
be easy to process with
cutorawk.Behavior when run un-attached to a terminal
Consistent use of
STDERRCurrent: "Showing x of y pull requests in owner/repo" is always printed to STDERR
Desired: Nothing is printed to STDERR (except warnings/errors) if running non-interactively
reopen
Behavior when
STDINis piped to commandCurrent: Validation error
Desired: STDIN is parsed as a single issue argument.
Behavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Consistent use of
STDERRstatus
Behavior when
STDINis piped to commandBehavior when
STDOUTis piped outCurrent: Same human-oriented output is printed
Desired:
grep/awk/cutfriendly outputBehavior when run un-attached to a terminal
Consistent use of
STDERRview
Behavior when
STDINis piped to commandCurrent: Ignored
Desired: STDIN parsed as single issue argument
Behavior when
STDOUTis piped outCurrent: Rendered markdown and human metadata written to pipe
Desired: Raw markdown is printed, possibly made possible via a --raw flag. Metadata printed
linewise for grepping.
Behavior when run un-attached to a terminal
Consistent use of
STDERRgh repo
clone
Behavior when
STDINis piped to commandCurrent: Ignored
Desired: STDIN parsed as single repo argument
Behavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Consistent use of
STDERRCurrent: Output from git is on both STDERR and STDOUT. We print nothing ourselves to STDOUT.
Desired: Git information should all be on stderr and potentially filtered (without a --debug or
--verbose option). Only thing on STDOUT should be resulting URL of clone.
create
STDINis piped to commandSTDOUTis piped outSTDERRfork
Behavior when
STDINis piped to commandCurrent: Breaks survey. If non-interactive, it's ignored.
Desired: Parse as single repo argument and run non-interactively.
Behavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Current: Breaks survey.
Desired: Run non-interactively.
Consistent use of
STDERRCurrent: Mix of things printed to stderr/stdout
Desired: only thing on STDOUT should be resulting clone url
view
Behavior when
STDINis piped to commandCurrent: Ignored.
Desired: Parsed as single repository argument.
Behavior when
STDOUTis piped outCurrent: Rendered markdown and human metadata written to pipe
Desired: Raw markdown is printed, possibly made possible via a --raw flag. Metadata printed
linewise for grepping.
Behavior when run un-attached to a terminal
Consistent use of
STDERRgh alias
delete
Behavior when
STDINis piped to commandBehavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Consistent use of
STDERRCurrent: Status output to STDOUT
Desired: STDOUT is empty, STDERR is used.
list
STDINis piped to commandSTDOUTis piped outSTDERRset
Behavior when
STDINis piped to commandBehavior when
STDOUTis piped outBehavior when run un-attached to a terminal
Consistent use of
STDERRCurrent: Status output to STDOUT
Desired: STDOUT is empty, STDERR is used.
gh api
STDINis piped to commandSTDOUTis piped outSTDERRgh config
set
STDINis piped to commandSTDOUTis piped outSTDERRget
STDINis piped to commandSTDOUTis piped outSTDERRgh gist
create
STDINis piped to commandSTDOUTis piped outSTDERR