Skip to content

Commit 00f9e66

Browse files
authored
Merge pull request #71 from ingkebil/fix-completion
Fix autocompletion for search, ls & short-form commands
2 parents 1fb3d4f + 1ec25b7 commit 00f9e66

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

notes.bash_completion

+8-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ _notes_complete_notes() {
2121
}
2222

2323
_notes_complete_commands() {
24-
local valid_commands="new find grep open ls rm cat"
24+
local valid_commands="new find grep open ls rm cat search"
2525
COMPREPLY=($(compgen -W "${valid_commands}" -- "${1}"))
2626
}
2727

@@ -34,18 +34,21 @@ _notes()
3434

3535
if [[ $COMP_CWORD -gt 1 ]]; then
3636
case "${COMP_WORDS[1]}" in
37-
new)
37+
new|n)
3838
_notes_complete_notes "$cur"
3939
;;
40-
find)
40+
find|f)
4141
_notes_complete_notes "$cur"
4242
;;
4343
grep)
4444
;;
45-
open)
45+
open|o)
4646
_notes_complete_notes "$cur"
4747
;;
48-
cat)
48+
cat|c)
49+
_notes_complete_notes "$cur"
50+
;;
51+
ls)
4952
_notes_complete_notes "$cur"
5053
;;
5154
esac

test/test-bash-completion.bats

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ teardown() {
2121
assert_contains "open" "${COMPREPLY[@]}"
2222
assert_contains "ls" "${COMPREPLY[@]}"
2323
assert_contains "rm" "${COMPREPLY[@]}"
24+
assert_contains "search" "${COMPREPLY[@]}"
2425
}
2526

2627
@test "Should show matching note when found" {

0 commit comments

Comments
 (0)