Giter Club home page Giter Club logo

harsh's People

Contributors

ais avatar blinry avatar manu-cyber avatar vchslv13 avatar wakatara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

harsh's Issues

incomplete log entry causes a crash when viewing the log

Describe the bug
If you ctrl-c during ask/log entry then an incomplete record causes a crash when you view the log.

To Reproduce

If your log is expected to have 3 entries per day then if you hit ctrl-c before providing an entry for each expected log line, the next time you view your log you get a crash:

$ h l                                                                                                                                                                                                              10:09:20
panic: runtime error: index out of range [-9223372036854775808]

goroutine 1 [running]:
main.buildSpark(0xc00010a000, 0x7, 0x8, 0xc000084a80, 0x250e0e80, 0xed6020c31, 0x775640, 0xbfb518ac650e0e80, 0x92565, 0x775640, ...)
        /home/peter/Code/harsh/harsh.go:237 +0x313
main.main.func3(0xc000082640, 0x1, 0x1)
        /home/peter/Code/harsh/harsh.go:107 +0x1eb
github.com/urfave/cli/v2.(*Command).Run(0xc0000ac480, 0xc000082580, 0x0, 0x0)
        /home/peter/Code/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:164 +0x4b9
github.com/urfave/cli/v2.(*App).RunContext(0xc000001200, 0x637fc0, 0xc0000121b0, 0xc00000c080, 0x2, 0x2, 0x0, 0x0)
        /home/peter/Code/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:306 +0x790
github.com/urfave/cli/v2.(*App).Run(...)
        /home/peter/Code/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:215
main.main()
        /home/peter/Code/harsh/harsh.go:131 +0x430

Make sure your habit and log files are where they should be: Yes

~/.config/harsh/habits
~/.config/harsh/log

Expected behavior

I would expect the missing entries to show a default incomplete view.

Environment (please complete the following information):

Linux lenovo-x1e 5.6.14-1-default #1 SMP Wed May 20 08:32:48 UTC 2020 (b0ab48a) x86_64 x86_64 x86_64 GNU/Linux

NAME="openSUSE Tumbleweed"
# VERSION="20200618"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20200618"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed:20200618"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
LOGO="distributor-logo"
  • Harsh version 0.8.4

Additional context

Sorry! Please choose a valid number (0-7) Error on Windows

Harsh binary does not work on Windows

On initial launch when prompted to enter how many days back harsh should start tracking in days, entering any number or carriage return, will return an error "Sorry! Please choose a valid number (0-7)"

To Reproduce

Steps to reproduce the behavior:

  1. Launch "harsh.exe ask" on Windows on command line
  2. When prompted, enter any number between 0 to 7 or a carriage return

Expected behavior

Harsh should accept the input and set up log file.

Environment

  • OS: Windows
  • OS version:Windows 10
  • Harsh version 0.8.6

Actual Behavior

C:\harsh>harsh ask

Your log file looks empty. Let's setup your tracking.

How many days back shall we start tracking from in days?

harsh will ask you about each habit for every day back.

Starting today would be 0. Choose. (0-7) 0

Sorry! Please choose a valid number (0-7) 1

Sorry! Please choose a valid number (0-7) 2

Unexpected output of ask command

harsh a prints out some dates for no apparent reason.

siriak@siriak-laptop:~$ harsh a
2021-07-11:
2021-07-12:
2021-07-13:
2021-07-14:
2021-07-15:
2021-07-19:
         Habit1                                                           ━━━! [y/n/s/⏎] 

To Reproduce

  1. Install attached configs
  2. Run harsh a

Expected behavior

harsh output starts with

2021-07-19:
         Habit1                                                           ━━━! [y/n/s/⏎] 

Environment

  • OS: linux
  • OS version: Linux siriak-laptop 5.11.0-22-generic #23-Ubuntu SMP Thu Jun 17 00:34:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Harsh version: 0.8.10

Note
I had to add extension .txt to files for GitHub to accept them, please rename them to habits and log without the .txt extension to reproduce the bug.

Attachments
habits.txt
log.txt

add --no-color option

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.

Add data stats to view progress

We're trying to keep harsh as minimal as possible, but...

Is your feature request related to a problem? Please describe.
I'm frustrated when I only get a visual representation of my habits' progress and no data. I have to parse the text files with some tool like q or create a SQLite database out of it to get some basic stats (current streak, longest streak, days tracked, days successful).

Describe the solution you'd like
harsh stats would output something along the lines of:

habit A : 100 day streak : 400 totally logged, 800 days tracked

Describe alternatives you've considered
See above: Using external tools like q or SQlite

Snap support and simplifying editing of habits

Problem
To add, remove or amend a habit I need to edit the config file by hand. In the README.md it's stated that it resides at ~/.config/harsh/ on Linux. This is not the case if harsh is installed from the Snap store. In such a case, config is located at ~/snap/harsh/current/.config/, which is (1) too long to edit files there by hand IMO, (2) gets cleared when harsh is uninstalled.

Solution
As to (1), I see the following options:

  1. Provide a command to print configuration root so that it can be found to edit configs. (harsh config or smth like that prints out ~/snap/harsh/current/.config/)
  2. Provide commands to add, remove and rename habits. (Actually, renaming is very important because for it to work correctly you need to rename the habit in both the config file and log file. I can imagine that this is inconvenient to do by hand for some/many users)

As to (2), idk. Would be nice to preserve configs IMO, but I'm not sure if it's possible for snap apps without unconfined mode and how it can be done. Not really a problem for me personally because I do backups of the home folder every 4 hours :) But other people can lose their data because of that behavior. Usually (read: for apps installed through apt), config lives separately from binaries and it's preserved when uninstalling an app.

Unable to install on macOS 11.5.1 via Homebrew

Describe the bug

Unable to install on macOS 11.5.1 via Homebrew

To Reproduce

Steps to reproduce the behavior:

  1. brew install wakatara/tap/harsh

Make sure your habit and log files are where they should be:

~/.config/harsh/habits
~/.config/harsh/log

Expected behavior

Successful installation.

Environment (please complete the following information):

  • OS: mac
  • OS version: 11.5.1
  • Harsh version [harsh --version]

Additional context

The following error when installing via Homebrew:

==> Installing harsh from wakatara/tap
==> Downloading https://github.com/wakatara/harsh/releases/download/v0.8.10/harsh_Darwin_x86_64.tar.gz
Already downloaded: /Users/alan/Library/Caches/Homebrew/downloads/7273ad51b87cbf5dd695d85f62adcb005edc79ce5aaff9834ac36b7d2595b3eb--harsh_Darwin_x86_64.tar.gz
Error: An exception occurred within a child process:
  NoMethodError: undefined method `path' for nil:NilClass
Did you mean?  paths

Thanks!

Log padding sometimes isn't even for each habit (past a certain habit line length?)

Describe the bug

I just started trying out harsh. With certain habit names, the padding on those lines in the log is off--the ends of the graph don't line up vertically. I thought I might have hit an edge case by manually padding out my habit names with spaces so they'd line up on the other side, but I tried replacing all the spaces with a letter and it had the same issue.

Is there some limit to the length of habit names?

This is what I get from harsh log: (the right end of some of the lines is offset)

             Use harsh.                                                                                                     ━ 
             Bike ride.                                                                                                     ━ 
          Clean studio.                                                                                                     • 
Mowing                                                                                                                      ━─── 
 - paths out back                                                                                                              ━ 
 - around fruit trees                                                                                                          ━ 
 - back lawn                                                                                                                    !
 - side field & drive                                                                                                           !
 - lake path                                                                                                                    !
                   ***.                                                                                                   ━━━!
       Go to bed by 10.                                                                                                   ━━━!
Yesterday's Score: 66.7%

If I remove three trailing spaces from each offending habit (in both the habits and the log file so they still match), I get what looks like a correct result:

                                                                                                                         ▁▃▃▆ 
             Use harsh.                                                                                                     ━ 
             Bike ride.                                                                                                     ━ 
          Clean studio.                                                                                                     • 
Mowing                                                                                                                   ━─── 
 - paths out back                                                                                                           ━ 
 - around fruit trees                                                                                                       ━ 
 - back lawn                                                                                                                 !
 - side field & drive                                                                                                        !
 - lake path                                                                                                                 !
                   ***.                                                                                                   ━━━!
       Go to bed by 10.                                                                                                   ━━━!
Yesterday's Score: 66.7%

To Reproduce

habits and log files showing the issue: (given .txt extension just so I can upload to github)
habits.txt
log.txt

habits and log files with three spaces removed--they seem to work correctly:
habits.txt
log.txt

Expected behavior

I expect each day on the graph to line up vertically, whatever the habit is named.
If there's a limit to how long of habit names the log can show, I would just cut them off rather than messing up the graph.

Environment

  • OS: Linux Mint 20.1 Ulyssa
  • OS version: Linux rossmint 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Harsh version: Harsh version 0.8.8

Thanks!

log error

Describe the bug

For some reason, recently harsh stop to show log.
harsh log stats works fine as before

To Reproduce

Maybe I was track to fast that time when bug occur after.

Error message

panic: runtime error: index out of range [-9223372036854775808]

goroutine 1 [running]:
main.buildSpark({0xc0001d6000, 0xc, 0x10}, 0xc00019f6f8?, {0xc0001d6000?, 0xc?, 0x20?}, {0x7e6, 0xa, 0x1d})
	/home/runner/work/harsh/harsh/harsh.go:329 +0x405
main.main.func3(0xc00010d190?)
	/home/runner/work/harsh/harsh/harsh.go:116 +0x1d2
github.com/urfave/cli/v2.(*App).RunAsSubcommand(0xc0001209c0, 0xc000122580)
	/home/runner/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:495 +0xb3f
github.com/urfave/cli/v2.(*Command).startApp(0xc000174360, 0xc000122580)
	/home/runner/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:287 +0x78f
github.com/urfave/cli/v2.(*Command).Run(0x1176d60?, 0xc000128850?)
	/home/runner/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:95 +0xba
github.com/urfave/cli/v2.(*App).RunContext(0xc000120820, {0x11eeae0?, 0xc0001241e0}, {0xc000128000, 0x2, 0x2})
	/home/runner/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:341 +0xbfd
github.com/urfave/cli/v2.(*App).Run(...)
	/home/runner/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:247
main.main()
	/home/runner/work/harsh/harsh/harsh.go:188 +0x529

Expected behavior

harsh log shows track graph

Environment (please complete the following information):

  • OS: mac
  • OS version: 11.6.5
  • Harsh version 0.8.19

Additional context

This is my first time open issue on github, don't be to harsh please :)

Adjust the size of bars to the current terminal window

This issue has come to my attention in the latest update. The size of the bars for both "ask" and "log" are not properly formatted in small windows (see the figures). This disrupts the intuitiveness of a graph-based progress report, as it is challenging to understand the bars that are spread across multiple lines, especially now that weekdays are also displayed on the "log".

While this issue is resolved by maximizing the window size, on smaller screens, such as my laptop, the bars are only properly formatted in full-screen mode. This slightly increases the attrition for tracking and logging habits.

A easy implementation (I think!) would be a option in the configuration file to specify the number of columns for which the graph bars should be printed.

image
image

Incorrect validation in initial ask

I've installed harsh from snap and when I run ask for the first time it asks for "How many days back shall we start tracking from in days?" and states that "Starting today would be 0. Choose. (0-7) ". Choosing 0 works, but choosing 7 doesn't:

siriak@siriak-laptop:~$ harsh a
Your log file looks empty. Let's setup your tracking.
How many days back shall we start tracking from in days?
harsh will ask you about each habit for every day back.
Starting today would be 0. Choose. (0-7) 
7
Sorry! Please choose a valid number (0-7) 0
2021-07-17:
                  Gymmed                                                             !! [y/n/s/⏎]

To Reproduce

  1. Install a fresh copy of harsh from snap
  2. Run harsh l to create config files
  3. Run harsh a and enter 7 when asked for days.

Expected behavior

I expected 7 to work as stated in command description. I'd also write it as a closed [0; 7] or half-open [0; 7) interval depending on whether 7 is included or not.

Environment

  • OS: Ubuntu 21.04
  • OS version: Linux siriak-laptop 5.11.0-22-generic #23-Ubuntu SMP Thu Jun 17 00:34:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Harsh version: 0.8.9

Also write an entry in a ledger journal file

We're trying to keep harsh as minimal as possible, but...

Is your feature request related to a problem? Please describe.

I would like to create an entry in a ledger journal file each time a habit is done

See eg https://www.reddit.com/r/plaintextaccounting/comments/wibbk2/tracking_chores_for_my_kids_but_i_need_a_way_to/

Describe the solution you'd like

A way to define a way to not only write to the log, but also to another file and define what to be written for each habit done:

eg for at habit called 'Alexander stuegulv' done on 2022-08-04 something like:

2022-08-04
    (Alexander stuegulv)              1

Add frequency per time period programming for habit completion

Hello! I believe you've accomplished everything one would expect from a minimalist habit tracker. However, there is a feature that I feel is lacking.

When setting up habits, there should be a way to program them to be completed a specific number of times within a defined period. For example, consider going to the gym. I usually go six times a week, and currently, there is no option to specify this when setting up the habit. While I could choose to skip when the prompt comes up on my off days, dealing with multiple habits with different frequencies per time period (in this case, a week) can become quite convoluted. It would be very helpful to have a tool that automates this check-up for you.

Unfortunately, I do not have the slightest idea of how to implement it, or if it is even doable given the application's original goals and concepts. I just feel that this is the only thing that keeps it from being the best habit tracker I've ever used.

Confused about the frequency

Hi! I've been looking into using harsh, but I am confused about the frequency in the habits file and the explanation in the README. I get that 1 is for daily habits, and 7 for weekly habits. But what does it mean that 0 is for tracking habits? Is it just a daily habit that will not trigger warnings? I am also confused about the numbers thing altogether, because even though I tried setting habits to 1, 2 and 7, using harsh ask will always ask for all the habits in my habits file, even the ones that are not daily. Am I missing something about how to use it?

`harsh ask` doesn't work correctly between 1am and 2am just after DST happens

Describe the bug

Between 1am and 2am, harsh ask does not ask me about today's habits, even if they are not done. It will still ask me about yesterday's habits if they are not done.

To Reproduce

Steps to reproduce the behavior:

  1. Let's say today is Saturday.
  2. At 11:10 pm on Saturday, run harsh ask and answer all the questions as normal.
  3. At 12:10 am on Sunday morning, run harsh ask. Observe that it asks you for Sunday's habits, as expected. Don't give answers to any of the questions.
  4. At 1:10 am on Sunday morning, run harsk ask. Observe that it prints nothing, as if there were no habits to do on Sunday.
  5. At 2:10 am on Sunday morning, run harsh ask. Observe that it asks you for Sunday's habits, just like it did two hours ago.

Make sure your habit and log files are where they should be:

~/.config/harsh/habits
~/.config/harsh/log

Yup, they're there.

Expected behavior

I expected harsh ask to ask me about today's habits even if I run it at 1:10 am.

Environment (please complete the following information):

  • OS: Mac
  • OS version: Monterey 12.3
  • Harsh version 0.8.16

Additional context
I live in the UK, and hence my computer is in British Summer Time. When I say 1am, I mean in British Summer Time.

I'd guess that this bug is caused by the Go library/something unique about my computer/something else, and not by harsh. I don't actually need to use harsh between 1am and 2am, so I'm posting this bug mostly because I'm curious why harsh does this.

P.S. I think harsh is great, and it has made me better at getting habits done.

Nixpkg

Are you cool with me packaging harsh for nixos?

Add an optional "ask when due" option in config

We're trying to keep harsh as minimal as possible, but...

Is your feature request related to a problem? Please describe.
There are some non-daily habits that I don't want to be asked about until they ought to be done. An example is checking in on relatives. I'd like to do this weekly or biweekly, so I don't need to be asked about it daily.

Having multiple weekly habits like can slow down the harsh ask process.

Describe the solution you'd like
Perhaps an option that specifies when harsh asks about a particular habit. The config could have an option like:

Check in on parents: 7: 2
Brush teeth: 1

In this case, "Check in on parents" should be done every week, but will only be asked about 2 days before it is expected to be done. The option is not specified with "Brush teeth", so it is still asked about daily.

Describe alternatives you've considered
I've considered using calcurse and other scheduling programs for such habits, but enjoy the simplicity of having one application for habits and another for general appointments.

[FEATURE REQUEST] Add command to open harsh config files

We're trying to keep harsh as minimal as possible, but...

Is your feature request related to a problem? Please describe.
Making a quick change to Harsh configuration files can be inconvenient and clunky. For example, when working in another directory and wanting to make a quick change to harsh – this usually requires changing directories back to ~ home and then a separate command to open the config file in the editor of choice.

Describe the solution you'd like
A harsh config command that opens config files. It can be split into two commands, like harsh config log and harsh config habits, to launch the log and habit files respectively.

The preferred editor could be saved as a variable somewhere, or as an argument (either are fine with me).

Describe alternatives you've considered
I alias hcf in .zshrc/.bashrc to open the config directory in the editor.

Additional notes
Thanks for Harsh! It's a great CLI habit tracker :)

more control of which day or range you specifically want to backfill from

We're trying to keep harsh as minimal as possible, but...

Is your feature request related to a problem? Please describe.
Just started using the tool so there's no history yet.
If I go to fill in my log using ask, it starts from the furthest unfilled date but I only want to fill in yesterday's log.

If you start with an empty log it does ask you about how far back you want to start filling the log in from:

$ h a 
Your log file looks empty. Let's setup your tracking.
How many days back shall we start tracking from in days?
harsh will ask you about each habit for every day back.
Starting today would be 0. Choose. (0-7) 
2
2020-06-23:

but the next time you go to log, it goes back to the furthest point to start asking for data:

$ h a                                                                                                                                                                                                           
2020-06-17:

Describe the solution you'd like
I can just go through and skip all these to get up to current or where I want to get up to, but it might be nice to be able to pick the data I want to fill in specifically or from which date forward I want to fill in for.

Describe alternatives you've considered
I guess I could go hand adjust the log file manually.

Additional context

[FR] Support habits with quantity

We're trying to keep harsh as minimal as possible, but...

Is your feature request related to a problem? Please describe.

E.g., I want to exercise for 45 minutes, study for 6 hours, etc. These are hard to fit into a binary done/undone.

Describe the solution you'd like

I like to be able to add a desired quantity to my habits ala https://github.com/codito/habito :

$ # add a habit
$ habito add writing 750.0 --units words
You have commited to 750.0 words of writing every day!

For plotting, perhaps we can use the height of blocks to indicate how much done each habit is.

Add quantity tracking

Is your feature request related to a problem? Please describe.

harsh is a great habit tracker and does almost everything I need (including logging comments!), but one roadblock I'm consistently running into is tracking quantities. Many of my habits – language learning lessons or words written – rely on quantities and a certain goal, rather than yes/no/skip habits like waking up by a certain time.

Describe the solution you'd like

The ability to track quantities and set goals for habits to count as fulfilled or partially fulfilled. This can be done through either a new sub-command or – in the interest of keeping things minimal – a new syntax option. Hashes (#) can stay reserved for comments, and another symbol (perhaps equals =?) can denote a quantity.

An alternative habit tracker I've tried recently is habito, which does a great job at quantities but unfortunately lacks harsh's comment logging.

Describe alternatives you've considered

Manually logging quantities as comments has certainly crossed my mind, but a couple of flaws lie in this. Namely:

  • high maintenance – if I write one session in the morning and log the habit as completed with a comment (e.g. y # 350), I'd have to manually add a second quantity and edit the log file accordingly.
  • easy to forget
  • hard to export and visualize, although certainly not impossible (especially with the use of grep and a bit of scripting)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.