wakatara / harsh

Habit tracking for geeks. A minimalist, command line tool for tracking and understanding your habits.
MIT License
137 stars 11 forks source link

add --no-color option #22

Closed skbolton closed 1 year ago

skbolton commented 1 year ago

I have started dumping the output of harsh log in my daily journal files. This makes it so that I can reflect on each day's graph. I do this in neovim by running :.! harsh log. Afterwards I need to go in and clear out the color escape codes from the output so that things line up without ugly escape sequences. The harsh log stats is even harder to clean up all the color codes.

Describe the solution you'd like Adding a --no-color or something similar to all output commands that skip colonizing output

Describe alternatives you've considered There are scripts that you can pipe input into and they will strip out the color codes. Issue I am running into is that they are also transforming the output and breaking formatting too for some reason.

Additional context I am willing to create a pr for this. I am not a go expert but the code seems simple enough.

wakatara commented 1 year ago

Hey @skbolton !

First off, thanks for using harsh!

I have to admit that is a use case I hadn't thought of (tho interesting!). I'd never checked piping the output into n/vim but de-colourizing seems a useful feature for anyone that's using this for any sort of logging outside of the cli, so makes sense to add. (you also taught me something!... I had never seen the :.! command used to pipe output into vim before... though weirdly, have used :! command for years... =] ).

Flying today, so will try to take a look tomorrow on the change.

(I was also was doing some thinking about how to handle longer running habit tracking... like when you change or remove habits or the frequency and want to track your, er... tracking) so was about to play with the code again this week.)

skbolton commented 1 year ago

Thanks for taking a look. There is all sorts of cool things you can do with input and output in vim article

wakatara commented 1 year ago

OK, this was way easier than I thought it would be. There's now a global option to remove colour output (you have no idea how much it kills me to use the American spelling of) with harsh --no-color log stats or harsh -n log stats which should fix your problem. (in fact, if you hate the colour output just alias harsh with the option in your shell or such (mine is h log etc...

If you're using brew or snaps it shoudl alreayd be available via brew etc, or you can grab the release from: https://github.com/wakatara/harsh/releases/tag/v0.8.22 (or compile manually =] ).

Hope that solves your issue with the vim command logging!

(And thanks for the article!)