Add color for --help when output a tty#377
Conversation
|
Travis CI testing fails because the added packages are not vendored. Could you guys help me out with this? All the actual tests pass fine. |
|
@dborzov I'll try vendoring it later tonight/tomorrow. but if you get at it before me, you should be able to:
It sounds like you did all this already, but ran into problems. can you post any errors you got here? Thanks |
|
@chriscool tnx! so apparently it attempts to look up the original vendored packages locally for some reason and freaks out when it does not find them. I guess you guys have them installed already so you don't see this. |
|
OK, so the fix i found was running |
Yeah, you may want to |
|
@chriscool yeah, |
|
@dborzov good to know, thanks! |
to help out with concerns like this one: #377 (comment)
|
Maybe we should put Thoughts @maybebtc ? |
commands/cli/helptext.go
Outdated
There was a problem hiding this comment.
not everyone uses white on black. this should be c.DefaultColors["default"] i think.
And these colors should be configurable in the config probably. (can get to that later)
|
Also, while some people like color (i do, sometimes), others don't. This should definitely be configurable. And possibly defaulted to off. |
We group templates and all the string variables separately and update the color tags in the init depending on if the output is a terminal
TerminalColors flag is to turn on and off coloring for terminal output. TerminalColors does not quite fit into the existing config subgroups, so I added Config.Preferences struct. The idea is to keep all the local appearance and formatting prefences there, whether it is for terminal output or WebUI.
|
Hey hey! So I made the suggested changes. I added the config flag for Terminal Colors: I ended up creating a new config subgroup for stuff like this: it is called Preferences. The idea is that all the local formatting and appearance-related settings can go there: stuff like the interface language, WebUI preferences and so on. I moved I am having a hard time reading off that flag's value when calling the help function, can anyone point me at what to call? |
There was a problem hiding this comment.
How to read off the config's flag from here? I thought it has to be:
ctx := invoc.req.Context()
cfg, _ := ctx.GetConfig()
// we get cfg.Preferences.TerminalColors
but invoc.req is not even initialized by default.
|
@jbenet, plz CR :) |
|
@dborzov sorry for the delay-- i havent had much time to CR code right now-- in particular tricky places like this part (main is really tricky :/ ). I'll try to get to this in the next few days. |
|
closing due to inactivity, please reopen as necessary note: all pull requests older than three weeks may be closed in an effort to keep our open pull requests more focused. |
IPFS's
--helpoutput now gets Chrismas lights when the output is on the terminal!See #340
Color rendering is only when stdoutput is on the terminal.
This uses
github.com/mattn/go-isattyfor checking if the output is on a terminalhttps://github.com/mitchellh/colorstringfor color coding stringsI was not able to add these packages to Godep. It probably should be
make vendororgodep save -r ./...but these don't do the trick. What is up with that?Here is what it looks like for the standard Ubuntu color scheme:
