Skip to content

Commit 2c8fce9

Browse files
committed
Added Config file support
1 parent d09d73c commit 2c8fce9

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ curl https://cdn.rawgit.com/pimterry/notes/v0.1.2/notes > /usr/local/bin/notes &
2929

3030
By default your notes live in ~/notes, but you can change that to anywhere you like by setting the `$NOTES_DIRECTORY` environmental variable.
3131

32+
## How do I configure this?
33+
34+
You can set the configuration by creating a file at "~/.config/notes/config". We've included an example for you (config.example) that you can copy.
35+
3236
### Bash completion
3337

3438
If you want bash autocompletion copy the completion script into the bash completion directory. The bash completion directory is `/usr/share/bash-completion/completions/` on a typical debian jessie install, you can you can get the bash completion directory by running the following command:

config.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This is an example configuration file for notes
2+
# To use it, copy to ~/.config/notes/config
3+
# This config is case sensitive
4+
5+
# Set the editor that notes are opened with
6+
EDITOR=nano

notes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/usr/bin/env bash
22

3+
# Look for configuration file at ~/.config/notes/config and use it
4+
if [ -f ~/.config/notes/config ]; then
5+
. ~/.config/notes/config
6+
fi
7+
38
configured_dir=${NOTES_DIRECTORY%/} # Remove trailing slashes
49
notes_dir="${configured_dir:-$HOME/notes}"
510
escaped_notes_dir="$(printf "$notes_dir" | sed -e 's/[]\/$*.^|[]/\\&/g')"

0 commit comments

Comments
 (0)