Commit graph

21 commits

Author SHA1 Message Date
vilmibm
b7765591b7 remove package level terminal check state 2020-07-17 15:02:05 -05:00
vilmibm
36ade42ba3 scriptability improvements: issue commands
This commit is part of work to make gh more scriptable. It includes both
some general purpose helpers towards this goal as well as improvements
to the issue commands. Other commands will follow.

- Adds `utils/terminal.go` for finding out about gh's execution environment
- introduces `stubTerminal` for either faking being attached to a tty or not during tests
- updates issue commands to behave better when not attached to a tty:
  - issue list doesn't print fuzzy dates
  - issue list doesn't print header
  - issue list prints state explicitly
  - issue create no longer hangs
  - issue create fails with clear error unless both -t and -b are specified
  - issue view prints raw issue body
  - issue view prints metadata in a consistent, linewise format
2020-07-14 12:30:53 -05:00
Mislav Marohnić
04b18ea8cb 🔥 unused var 2020-06-22 19:32:06 +02:00
Mislav Marohnić
55be0d2a9c Tweak isColorEnabled 2020-06-22 19:18:18 +02:00
gabgodBB
e6e8f701a2 Issue #930 - Removing color for output files 2020-06-12 14:26:38 -03:00
gedenata
4c94d126da variable global color 2020-06-10 14:02:42 +08:00
gedenata
81799caeb6 variable global color 2020-06-10 13:59:28 +08:00
gedenata
417de6257a variable global color 2020-06-10 13:57:31 +08:00
Brett Buddin
48e7df2337
Any non-empty value should be a disabling intent.
Conforms to the informal standard proposed in https://no-color.org
2020-04-02 20:31:04 -04:00
Brett Buddin
21e445beab
Support NO_COLOR environment variable to disable color. 2020-04-02 20:22:55 -04:00
Mislav Marohnić
9c2efd6c1c Extract reusable IsTerminal() 2020-02-21 12:46:21 +01:00
Mislav Marohnić
a0458956c0 Add docs to color funcs 2019-11-28 11:55:14 +01:00
Mislav Marohnić
e636e3e613 Merge remote-tracking branch 'origin/master' into cygwin-color 2019-11-28 11:52:45 +01:00
Mislav Marohnić
ebb7f39985 Merge remote-tracking branch 'origin/master' into ansi-colorfunc 2019-11-28 11:48:54 +01:00
Mislav Marohnić
b6fa88337d Ensure that commands print to a colorable output
If a command does `fmt.Print(...)` for output that contains ANSI color
codes, this not safe on Windows. We have to ensure that we always use
the `fmt.Fprint*` family of functions with a writer that was transformed
using `utils.NewColorable()`.
2019-11-27 20:51:51 +01:00
Mislav Marohnić
24b04b5fca Make use of ansi.ColorFunc
Speed up repeated calls to color functions by using ansi.ColorFunc to
create a closure per each color.

https://godoc.org/github.com/mgutz/ansi#ColorFunc
2019-11-27 19:16:53 +01:00
Mislav Marohnić
004ab1e9db Fix color output to Git Bash 2019-11-27 18:58:23 +01:00
nate smith
ffa5ce456a do not use color when stdout is not a terminal 2019-11-06 10:15:27 -07:00
nate smith
e8634ca5d8 use mgutz/ansi in utils 2019-11-05 13:47:48 -07:00
Corey Johnson
9c218075fb Add bold 2019-10-15 14:55:15 -07:00
Corey Johnson
cff76fbc22 Use gookit for colors 2019-10-15 14:51:33 -07:00