Closed apatil closed 5 years ago
Hmm, sorry, I'm not totally convinced by this.
I can just about see cases where you might want this, but I'm not clear why notes --editor myeditor new
is better than EDITOR=myeditor notes new
. The latter already works, doesn't require any separate logic, and using env vars only feels a bit simpler conceptually that having two different sources of configuration.
What do you think? Is there a reason that doesn't work?
The issue is that the config file always overrides environmental variables, and both are always read by the script. I want to put most of my notes in one folder but some notes in another folder.
Since the config is a bash file itself, you could easily put a test in the config like so:
if [ -z "$EDITOR" ]
then
EDITOR=nano
fi
This would allow an override such as @pimterry had suggested. Closing pull request as duplicate functionality.
What if I sometimes want NOTES_DIR to be /keybase/private/me/notes and sometimes /keybase/teams/someteam/notes? It's cumbersome to keep editing the config file just to put notes in another folder.
In your config:
if [ -z "$NOTES_DIR" ]
then
NOTES_DIR=<PRIMARY>
fi
And if you wanna use a different directory, run notes like:
NOTES_DIR=<Directory> notes ...
Ah, I see. That works.
Adds ability to override config with CLI options.
I haven't added tests or updated the man page yet. I wanted to check first whether you'd be interested in this change.
Checklist