We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b1fa74 commit 6323faaCopy full SHA for 6323faa
notes.bash_completion
@@ -8,6 +8,7 @@ _notes_complete_notes() {
8
local items=($(compgen -f "$notes_dir/$1" | sort ))
9
IFS="$OLD_IFS"
10
for item in "${items[@]}"; do
11
+ [[ $item =~ /\.[^/]*$ ]] && continue
12
[[ -d $item ]] && item="$item/"
13
local filename=${item#$notes_dir/}
14
COMPREPLY+=("${filename%.md}")
test/test-bash-completion.bats
@@ -44,3 +44,11 @@ teardown() {
44
assert_equal "${COMPREPLY[0]}" 'my note'
45
assert_equal 1 "${#COMPREPLY[@]}"
46
}
47
+
48
+@test "Should ignore hidden files" {
49
+ touch "$NOTES_DIRECTORY/note1.md"
50
+ touch "$NOTES_DIRECTORY/.hiddennote.md"
51
+ _notes_complete_notes ""
52
+ assert_equal "${COMPREPLY[0]}" 'note1'
53
+ assert_equal 1 "${#COMPREPLY[@]}"
54
+}
0 commit comments