Skip to content

Commit

Permalink
fix autocompletion when notes directory is not the default one
Browse files Browse the repository at this point in the history
  • Loading branch information
tardypad committed Aug 30, 2017
1 parent 673d39e commit b1e53be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions _notes
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ __notes_cmd ()

_notes ()
{
# Look for configuration file at ~/.config/notes/config and use it
if [ -f ~/.config/notes/config ]; then
. ~/.config/notes/config
fi

local configured_dir=${NOTES_DIRECTORY%/}
local note_dir="${configured_dir:-$HOME/notes}"

Expand Down
5 changes: 5 additions & 0 deletions notes.bash_completion
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash

_notes_complete_notes() {
# Look for configuration file at ~/.config/notes/config and use it
if [ -f ~/.config/notes/config ]; then
. ~/.config/notes/config
fi

local configured_dir=${NOTES_DIRECTORY%/} # Remove trailing slashes
local notes_dir="${configured_dir:-$HOME/notes}"
local OLD_IFS="$IFS"
Expand Down

0 comments on commit b1e53be

Please sign in to comment.