Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use YAML not JSON for .counter.dat #37

Open
icornelius opened this issue Nov 7, 2022 · 2 comments
Open

use YAML not JSON for .counter.dat #37

icornelius opened this issue Nov 7, 2022 · 2 comments
Assignees

Comments

@icornelius
Copy link
Collaborator

The --counter option assigns a serial number to new notes created with the zettel command. Usage:

--counter COUNTER     counter name (defaults to --id if present)

The file .counter.dat maintains the count of zetteln written for each COUNTER. This is serialized in JSON.

I suggest switching to YAML since that will introduce newlines in the file and simplify resolution of git merge conflicts in distributed projects. Alternatively, users could add .counter.dat to their .gitignore. Then each local system would keep its own separate count, defeating the purpose of a counter.

@icornelius
Copy link
Collaborator Author

The relevant commit, setting counter output, is d39210b. See also 02de204.

A final newline should be written to the end of .counter.dat, to facilitate display in the terminal (e.g., with cat).

@icornelius icornelius self-assigned this Dec 2, 2023
icornelius added a commit to icornelius/zettelgeist that referenced this issue May 24, 2024
@icornelius
Copy link
Collaborator Author

1989571 is sufficient because yaml.load reads any existing json-encoded .counter.dat on first invocation. There is no need for a dedicated one-time translation between formats, as yaml is a superset of json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant