Giter Site home page Giter Site logo

Comments (9)

nerdypepper avatar nerdypepper commented on August 21, 2024 2

@rpearce: @charles-l has opened a draft to handle the same, I could, for now:

  • warn users to use :quit to save and close
  • replicate the behavior of :quit on receiving SIGINT

@ondreian Now that I think about it, auto save shouldn't be too hard to implement, feel free to request it over at #10 (I will keep it in my list of things to do nevertheless).

from dijo.

StevenBlack avatar StevenBlack commented on August 21, 2024

Robert @rpearce I noticed that when I installed on MacOs with $ cargo install dijo it saves data just fine.

However if I clone this repo, then invoke with $ cargo run data is not saved.

Is this what you see, too?

from dijo.

rpearce avatar rpearce commented on August 21, 2024

@StevenBlack Thank you for your quick 👀!

I installed on macOS via $ cargo install dijo

from dijo.

ondreian avatar ondreian commented on August 21, 2024

I'm actually also having this problem on Ubuntu, it saved the first day's entries, but has not persisted anything for the next 2 days.

edit: I used cargo install to install it

edit 2: Yesterday (second day) I also added a new habit, and it did not save that habit.

from dijo.

nerdypepper avatar nerdypepper commented on August 21, 2024

Very strange, dijo should panic if your file permissions are wrong or if the directory is inaccessible. It is also weird that only some users are facing this issue.

@ondreian could you please paste the outputs of the following, after running dijo, adding a habit and quitting with :q:

  • dijo -V
  • ls -al ~/Library/Application\ Support/rs.nerdypepper.dijo (macOS)
  • ls -al ~/.local/share/dijo/ (gnu/linux)
  • echo $HOME (probably not relevant to this issue)

To answer your question regarding default directory @rpearce, dijo always selects Application Support over $XDG_DATA_HOME on macOS, because macOS doesn't follow XDG base dirs spec (usually).

from dijo.

ondreian avatar ondreian commented on August 21, 2024

@ondreian could you please paste the outputs of the following, after running dijo, adding a habit and quitting with :q:

  • dijo -V
dijo 0.1.4
  • ls -al ~/.local/share/dijo/ (gnu/linux)
total 16
drwxrwxr-x  2 benjamin benjamin 4096 Jul 20 11:49  ./
drwx------ 37 benjamin benjamin 4096 Jul 20 21:02  ../
-rw-rw-r--  1 benjamin benjamin    2 Jul 22 11:56 'habit_record[auto].json'
-rw-rw-r--  1 benjamin benjamin  241 Jul 22 11:56  habit_record.json

Shouldn't this be ~/.config/<user>? I have enabled=True enabled in my /etc/xdg/user-dirs.conf

  • echo $HOME (probably not relevant to this issue)
/home/benjamin

I did alt + f4 my terminal in totality when I shut down for the day, but when I was scanning the source code before I installed, it looked like it should persist the state anytime the state is changed. I shouldn't have to always manually :q to shutdown?

edit:
after some investigation if I do any sort of operations and then use alt +f4 to shutdown my terminal nothing is persisted, if I manually :q it is.

from dijo.

nerdypepper avatar nerdypepper commented on August 21, 2024

@ondreian ah, dijo doesn't autosave. You have to quit with :q to to save and quit. A :write command is in the works, to save state, but that would also be manual. At the moment, auto-save as a feature is not being worked on.

Shouldn't this be ~/.config/?

dijo saves data in $XDG_DATA_HOME and will be saving config files (once added) in $XDG_CONFIG_HOME, as per XDG base dirs spec. In the future, you should be able to choose a data dir to save .json records.

from dijo.

rpearce avatar rpearce commented on August 21, 2024

Wow -- :q totally was it. I was using ctrl+c. It almost feels like a SIGINT or SIGTERM or whatever should prompt you, but I'm not on that committee :)

On the XDG note, I have all those vars configured on macOS so that programs will use them, and I can version control those if I want. I wonder if there's a way to specify the save directory for dijo... closing, for the original thing has been sorted by me not using :q.

Thank you!!

from dijo.

ondreian avatar ondreian commented on August 21, 2024

ah, dijo doesn't autosave. You have to quit with :q to to save and quit. A :write command is in the works, to save state, but that would also be manual. At the moment, auto-save as a feature is not being worked on.

I can move this discussion to a new issue if you like, seems we have figured out the mystery of the lost information. Before I open a new issue, does autosave fit with the goals of this project?

from dijo.

Related Issues (20)

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.