"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/iostreams/iostreams.go" between
gh-cli-1.11.0.tar.gz and gh-cli-1.12.0.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

iostreams.go  (gh-cli-1.11.0):iostreams.go  (gh-cli-1.12.0)
skipping to change at line 143 skipping to change at line 143
if stderr, ok := s.ErrOut.(*os.File); ok { if stderr, ok := s.ErrOut.(*os.File); ok {
return isTerminal(stderr) return isTerminal(stderr)
} }
return false return false
} }
func (s *IOStreams) SetPager(cmd string) { func (s *IOStreams) SetPager(cmd string) {
s.pagerCommand = cmd s.pagerCommand = cmd
} }
func (s *IOStreams) GetPager() string {
return s.pagerCommand
}
func (s *IOStreams) StartPager() error { func (s *IOStreams) StartPager() error {
if s.pagerCommand == "" || s.pagerCommand == "cat" || !s.IsStdoutTTY() { if s.pagerCommand == "" || s.pagerCommand == "cat" || !s.IsStdoutTTY() {
return nil return nil
} }
pagerArgs, err := shlex.Split(s.pagerCommand) pagerArgs, err := shlex.Split(s.pagerCommand)
if err != nil { if err != nil {
return err return err
} }
skipping to change at line 205 skipping to change at line 209
} }
func (s *IOStreams) CanPrompt() bool { func (s *IOStreams) CanPrompt() bool {
if s.neverPrompt { if s.neverPrompt {
return false return false
} }
return s.IsStdinTTY() && s.IsStdoutTTY() return s.IsStdinTTY() && s.IsStdoutTTY()
} }
func (s *IOStreams) GetNeverPrompt() bool {
return s.neverPrompt
}
func (s *IOStreams) SetNeverPrompt(v bool) { func (s *IOStreams) SetNeverPrompt(v bool) {
s.neverPrompt = v s.neverPrompt = v
} }
func (s *IOStreams) StartProgressIndicator() { func (s *IOStreams) StartProgressIndicator() {
if !s.progressIndicatorEnabled { if !s.progressIndicatorEnabled {
return return
} }
sp := spinner.New(spinner.CharSets[11], 400*time.Millisecond, spinner.Wit hWriter(s.ErrOut)) sp := spinner.New(spinner.CharSets[11], 400*time.Millisecond, spinner.Wit hWriter(s.ErrOut))
sp.Start() sp.Start()
skipping to change at line 284 skipping to change at line 292
if s.TempFileOverride != nil { if s.TempFileOverride != nil {
return s.TempFileOverride, nil return s.TempFileOverride, nil
} }
return ioutil.TempFile(dir, pattern) return ioutil.TempFile(dir, pattern)
} }
func System() *IOStreams { func System() *IOStreams {
stdoutIsTTY := isTerminal(os.Stdout) stdoutIsTTY := isTerminal(os.Stdout)
stderrIsTTY := isTerminal(os.Stderr) stderrIsTTY := isTerminal(os.Stderr)
var pagerCommand string
if ghPager, ghPagerExists := os.LookupEnv("GH_PAGER"); ghPagerExists {
pagerCommand = ghPager
} else {
pagerCommand = os.Getenv("PAGER")
}
io := &IOStreams{ io := &IOStreams{
In: os.Stdin, In: os.Stdin,
originalOut: os.Stdout, originalOut: os.Stdout,
Out: colorable.NewColorable(os.Stdout), Out: colorable.NewColorable(os.Stdout),
ErrOut: colorable.NewColorable(os.Stderr), ErrOut: colorable.NewColorable(os.Stderr),
colorEnabled: EnvColorForced() || (!EnvColorDisabled() && stdoutI sTTY), colorEnabled: EnvColorForced() || (!EnvColorDisabled() && stdoutI sTTY),
is256enabled: Is256ColorSupported(), is256enabled: Is256ColorSupported(),
pagerCommand: pagerCommand, pagerCommand: os.Getenv("PAGER"),
} }
if stdoutIsTTY && stderrIsTTY { if stdoutIsTTY && stderrIsTTY {
io.progressIndicatorEnabled = true io.progressIndicatorEnabled = true
} }
// prevent duplicate isTerminal queries now that we know the answer // prevent duplicate isTerminal queries now that we know the answer
io.SetStdoutTTY(stdoutIsTTY) io.SetStdoutTTY(stdoutIsTTY)
io.SetStderrTTY(stderrIsTTY) io.SetStderrTTY(stderrIsTTY)
return io return io
 End of changes. 4 change blocks. 
8 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)