Snap support and simplifying editing of habits
siriak opened this issue ยท 4 comments
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:
- 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/
) - 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.
Thanks for chiming in on this and pointing out this behaviour (I don't use snaps myself even on my linux box - whichruns POPOS btw. Which I totally recommend and only uses flatpak and deb).
Tbh, snaps have been a total PITA to date and my original support for them was because of them being the default in Ubuntu though I've considerably soured on them since using them and then rejecting them myself. I have to admit I use flatpak or straight up .deb myself these days and by far the most alarming thing I am hearing in your report here is that an uninstall of the snap would nuke your config and log file. and result in data loss. I agree, that is absolutely unacceptable.
I'm going to see if there is a way to override writing the config and log file to the user home directory ~/.config/harsh
via snaps though worried this requires some sort of crazy approvals.
If not, I believe I will actually deprecate snap support completely (since it seems more about gui binary installs) and hook up nfps in the goreleaser github action to start building rpms and deb packages instead.
However, from my perspective on editing, I don't think the app (particularly one targeted at cli geeks) should have a feature easily trivially by most text editor in search and replace (heck, I'd use vim for this if it was in the right place... =] ).
... I don't think the app (particularly one targeted at cli geeks) should have a feature ...
As a CLI geek, I used sed
to rename habits and I agree with you on that. My concern was primarily on behalf of other users because most of the popular apps never require editing their files directly, only through this app's GUI/CLI. If you are ok with losing non-geek users, this is fine by me too.
As for removing support for snap, will you make a PPA or something else to have automatic updates? Having to download a .deb file from GitHub to reinstall a new version is inconvenient :(
@siriak
I am going to rewrite the docs to mention that if you do install the snaps version of the app (I am gonna add debs and rpms anyway, I think) that we highly recommend setting the ~/.config/harsh directory using the HARSHPATH
environment variable. As well as a warning about catastrophic deletion on uninstall if you don't.
So, the easy fix for you right now would be setting the HARSHPATH env variable.
I looked into setting up a PPA and it is a major pain for golang software for whatever reason, but will look at it after the deb and rpm binary setups (goreleaser is kinda great for that stuff.).
Keep in mind, the userbase is geeks. I have to admit, I may add convenience features like this in the future (actually theone on my mind most is changing the data format so it records the "last" periodicity so as you ramp up or down habits you get a better idea of how they're going longer term (and an easier calc and logic in the app) as well as being able to add comments with a #
after your response (cause sometimes I honestly forget things like... "whaaa? why did I skip that, that day?" when looking back... ๐
Alrighty, I'm going to close this ticket since HARSHPATH will take care of this. Just trying to figure out how to do that "warning sigil" in GH markup to make sure people see it when reading the docs. I am going to add in .deb and .rpm pakacges soon as I get some extra time on this.
Thanks again for bringing the snaps issue to my attention. Still a little shocked it works in that way, though I guess it's been mostly designed for putting in large gui binaries than these type of cli programs (though now wondering if flatpaks do the same sort of damage.