Skip to content

Commit

Permalink
sqlite3: Add some option arg (non-)completions
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Jun 2, 2018
1 parent 27efd8c commit 1c2b0d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion completions/sqlite3
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,23 @@ _sqlite3()
local dbexts='@(sqlite?(3)|?(s?(3))db)'

case $prev in
-help|-version|-separator|-nullvalue|*.$dbexts)
-help|-version|-lookaside|-mmap|-newline|-nullvalue|-pagecache|\
-scratch|-separator|*.$dbexts)
return
;;
-init)
_filedir
return
;;
-cmd)
compopt -o filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
return
;;
esac

[[ ${words[cword-2]} == -@(lookaside|pagecache|scratch) ]] && return

if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
return
Expand Down
4 changes: 4 additions & 0 deletions test/lib/completions/sqlite3.exp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ setup


assert_complete_any "sqlite3 "
sync_after_int

assert_complete_any "sqlite3 -"
sync_after_int

assert_no_complete "sqlite3 -scratch foo "
sync_after_int


Expand Down

0 comments on commit 1c2b0d7

Please sign in to comment.