You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I do var="$(toggl now)" and then echo $var, the output is not colored, as when I do just toggl now. This works with other commands, tldr for example.
toggl, version 2.4.3
zsh 5.8 (x86_64-apple-darwin21.0)
If this is caused by some misconfiguration or twisted expectations on my side, I'm sorry. Please let me know. 🙂
The text was updated successfully, but these errors were encountered:
I guess it's because we want plain text when e.g. outputing to a file, huh? I figured out how to bypass that for my use-case with unbuffer. So let me rephrase the issue:
It's be nice if toggl had a --colors=always parameter. 😁
StanczakDominik
changed the title
Colors are not preserved when output goes to variable
Add --colors=always option
Jan 23, 2023
color (Optional[bool]) – Force showing or hiding colors and other styles. By default Click will remove color if the output does not look like an interactive terminal.
So this is definitely possible, but would require a replacement of, most likely, every single call to click.echo ( a quick rg echo | wc -l puts this at 61 occurences) with something like toggl.helpers.echo (placement to be discussed!), which would be a thin wrapper around click.echo that checks the config (from toggl/utils/config.py?) for a new --colors flag (None by default) and passes that.
@haluzpav, would you be open to submitting a pull request? 🙂
StanczakDominik
changed the title
Add --colors=always option
Add --colors=always option for passing to clickJan 23, 2023
When I do
var="$(toggl now)"
and thenecho $var
, the output is not colored, as when I do justtoggl now
. This works with other commands,tldr
for example.If this is caused by some misconfiguration or twisted expectations on my side, I'm sorry. Please let me know. 🙂
The text was updated successfully, but these errors were encountered: