Reputation: 17157
I'm developing a CLI for a web todolist service. I'm done with the backend and have just started to write the CLI functions. Before I start, I tought what the best way was to store user data. I'm using ConfigParser for storing user specified preferencies. These are stored in ~/.confrc
.
The user data is in the form of Json. I'm using Python for my project. I'm getting these in the form of:
{"user_id": 1, "name": "Project_name", "color": "#ff8581", "collapsed": 0, "item_order": 1, "cache_count": 13, "indent": 1, "id": 455831}
Should I store this data to a configuration file, that will be proccessed via ConfigParser ? This may be good idea at first, but a project might have a name that is used by another project. Thus I can't store them via the RawConfigParser.set(). I could store them via the id, as they are unique, but than the conf file itself would be very clutter.
What would the best way to store a simple todolist user data ?
Upvotes: 2
Views: 417
Reputation: 9340
If there is only one file to store, using ~/.${PROJECT}rc
is a good idea, otherwise, use a separate directory ~/.${PROJECT}
.
You could also refer to the XDG Base Directory Specification.
Upvotes: 5