feat: detect os.Stdin/os.Stdout redirection/pipe mode#994
Merged
MichaelMure merged 3 commits intomasterfrom Jan 17, 2023
Merged
feat: detect os.Stdin/os.Stdout redirection/pipe mode#994MichaelMure merged 3 commits intomasterfrom
os.Stdin/os.Stdout redirection/pipe mode#994MichaelMure merged 3 commits intomasterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In support of #831 and #993, this PR adds the ability to detect whether input is coming from the terminal or is being redirected/piped into the
git-bugapplication as well as the corollary of output going to the terminal or being output to another application or file.In general, there seem to be three categories of output for commands:
os.StdErrand the machine-readable portion of their output toos.StdOutsuch as the output when creating a new bug (the id of the new bug should be written to StdOut and the " created" suffix should be written to StdErr.)All efforts should be made to create *nix friendly output using techniques 1 and 2 above - using
TerminalIOModeandRedirectedOrPipedIOModeshould be a last resort.This PR also includes an equivalent feature for
os.StdInwith the expectation that eventually commands such asbug newcould read input from StdIn instead of an editor with the existing behavior for separating the title and description (comment index 0).References #828.