diff --git a/autoload/db/adapter/redis.vim b/autoload/db/adapter/redis.vim index 68e8a51..e6bd0b8 100644 --- a/autoload/db/adapter/redis.vim +++ b/autoload/db/adapter/redis.vim @@ -7,7 +7,25 @@ function! db#adapter#redis#canonicalize(url) abort endfunction function! db#adapter#redis#interactive(url) abort - return ['redis-cli'] + db#url#as_argv(a:url, '-h ', '-p ', '', '', '-a ', '-n ') + let url = db#url#parse(a:url) + let cmd = ['redis-cli'] + for [k, v] in items(url.params) + " Specifying only connection releated flag here, missing flags can be added later + if k =~# '^\%(cert\|key\|cacert\|capath\|tls-ciphers\|tls-ciphersuites\)$' && v isnot# 1 + call add(cmd, '--' . k . '=' . v) + elseif k ==# 'c' && v =~# '^[1Tt]$' + " Some non-alias single char flags like `-c` needs to be passed + " with single hyphen `-` char + if len(k) == 1 + call add(cmd, '-' . k) + else + call add(cmd, '--' . k) + endif + else + throw 'DB: unsupport URL param `' . k . '` in URL ' . a:url . ', Check `:help dadbod-redis`' + endif + endfor + return cmd + db#url#as_argv(a:url, '-h ', '-p ', '', '', '-a ', '-n ') endfunction function! db#adapter#redis#auth_input() abort diff --git a/doc/dadbod.txt b/doc/dadbod.txt index 38bf73b..a7b0056 100644 --- a/doc/dadbod.txt +++ b/doc/dadbod.txt @@ -169,6 +169,9 @@ Redis ~ Redis doesn't have a username, so use a dummy one in the URL if a password is required. +Query parameters such as `c`, `cert`, `key`, `cacert`, `capath`, `tls-ciphers` +and `tls-ciphersuites` are passed as the corresponding command line options. + *dadbod-sqlserver* SQL Server ~ >