Skip to content

Commit

Permalink
Include new ls and rm commands in bash completion
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Dec 8, 2016
1 parent 9586aa3 commit d7ff4f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion notes.bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ _notes_complete_notes() {
}

_notes_complete_commands() {
local valid_commands="new find grep open"
local valid_commands="new find grep open ls rm"
COMPREPLY=($(compgen -W "${valid_commands}" -- "${1}"))
}

Expand Down
10 changes: 6 additions & 4 deletions test/test-bash-completion.bats
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ teardown() {
@test "Should list all commands" {
touch $NOTES_DIRECTORY/note1.md
_notes_complete_commands ""
assert_contains "new" ${COMPREPLY[@]}
assert_contains "find" ${COMPREPLY[@]}
assert_contains "grep" ${COMPREPLY[@]}
assert_contains "open" ${COMPREPLY[@]}
assert_contains "new" "${COMPREPLY[@]}"
assert_contains "find" "${COMPREPLY[@]}"
assert_contains "grep" "${COMPREPLY[@]}"
assert_contains "open" "${COMPREPLY[@]}"
assert_contains "ls" "${COMPREPLY[@]}"
assert_contains "rm" "${COMPREPLY[@]}"
}

@test "Should show matching note when found" {
Expand Down

0 comments on commit d7ff4f3

Please sign in to comment.