From d7ff4f3490206968dedf205cacd7269ba8c495cc Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Thu, 8 Dec 2016 16:37:05 +0100 Subject: [PATCH] Include new ls and rm commands in bash completion --- notes.bash_completion | 2 +- test/test-bash-completion.bats | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/notes.bash_completion b/notes.bash_completion index cf72268..cf0f0d6 100644 --- a/notes.bash_completion +++ b/notes.bash_completion @@ -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}")) } diff --git a/test/test-bash-completion.bats b/test/test-bash-completion.bats index c059205..2077833 100755 --- a/test/test-bash-completion.bats +++ b/test/test-bash-completion.bats @@ -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" {