RyanGreenup / cadmus

Shell Scripts to Facilitate Effective Note Taking
168 stars 7 forks source link

Support Multiple Configs #11

Open RyanGreenup opened 4 years ago

RyanGreenup commented 4 years ago

Ideally a user should be able to have multiple config files. Currently the default ~/.cadmus/config.json contains the location of the notes directory et cetera, I was just editing that directly when I needed to, but if we use the AUR then ~/.cadmus/config.json won't be suitable because:

  1. Updates with something like yay would destroy it
  2. The permissions of the directory, being created by pacman, will be such that the user can't edit it anyway

So this is a good time to think about a sane way to manage multiple configs.

What I was thinking is either:

  1. having multiple profiles that cadmus cadmus can switch between., OR
  2. The user can .cadmus.json file in a folder of notes, cadmus will look in parent directories up until a config is found and use that, if none is found it will take the default from ~/.config/cadmus/config.json.

The reason that multiple configs is helpful is best illustrated by an example, say that I have all my notes in one directory and the documentation for this project in another, ideally they will be in sepereate locations and I'd probably like to be able to have two seperate terminals for looking through my notes and the docs.

I'm leaning towards the 2nd option, does anybody have any input?

danimateo commented 4 years ago

hm yes I think multiple configs would be better, but maybe one general config in .cadmus that is created on the first run and optional configs in directories of notes that override the general config. What do you think?

RyanGreenup commented 4 years ago

Yeah I think that's perfect @danimateo , the config will have to go in ~/.config/cadmus/config.json though, because installing with Pacman removes wire privileges from ~/.cadmus

danimateo commented 4 years ago

Sure, that is the usual way, you are right