Skip to content

Commit

Permalink
Merge pull request #2269 from jqnatividad/template-completions
Browse files Browse the repository at this point in the history
`contrib(completions)`: add template command and update fetchpost
  • Loading branch information
jqnatividad authored Nov 4, 2024
2 parents 879d5fd + 2387718 commit 8b5cd86
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 71 deletions.
40 changes: 37 additions & 3 deletions contrib/completions/examples/qsv.bash
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ _qsv() {
qsv,table)
cmd="qsv__table"
;;
qsv,template)
cmd="qsv__template"
;;
qsv,to)
cmd="qsv__to"
;;
Expand Down Expand Up @@ -492,6 +495,9 @@ _qsv() {
qsv__help,table)
cmd="qsv__help__table"
;;
qsv__help,template)
cmd="qsv__help__template"
;;
qsv__help,to)
cmd="qsv__help__to"
;;
Expand Down Expand Up @@ -718,7 +724,7 @@ _qsv() {

case "${cmd}" in
qsv)
opts="-h --list --envlist --update --updatenow --version --help apply behead cat clipboard count datefmt dedup describegpt diff edit enum excel exclude extdedup extsort explode fetch fetchpost fill fixlengths flatten fmt foreach frequency geocode headers index input join joinp json jsonl lens luau partition pro prompt pseudo py rename replace reverse safenames sample schema search searchset select slice snappy sniff sort sortcheck split sqlp stats table to tojsonl transpose validate help"
opts="-h --list --envlist --update --updatenow --version --help apply behead cat clipboard count datefmt dedup describegpt diff edit enum excel exclude extdedup extsort explode fetch fetchpost fill fixlengths flatten fmt foreach frequency geocode headers index input join joinp json jsonl lens luau partition pro prompt pseudo py rename replace reverse safenames sample schema search searchset select slice snappy sniff sort sortcheck split sqlp stats table template to tojsonl transpose validate help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -1222,7 +1228,7 @@ _qsv() {
return 0
;;
qsv__fetchpost)
opts="-h --new-column --jaq --jaqfile --pretty --rate-limit --timeout --http-header --compress --max-retries --max-errors --store-error --cookies --user-agent --report --no-cache --mem-cache-size --disk-cache --disk-cache-dir --redis-cache --cache-error --flush-cache --output --no-headers --delimiter --progressbar --help"
opts="-h --payload-tpl --new-column --jaq --jaqfile --pretty --rate-limit --timeout --http-header --compress --max-retries --max-errors --store-error --cookies --user-agent --report --no-cache --mem-cache-size --disk-cache --disk-cache-dir --redis-cache --cache-error --flush-cache --output --no-headers --delimiter --progressbar --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -1656,7 +1662,7 @@ _qsv() {
return 0
;;
qsv__help)
opts="apply behead cat clipboard count datefmt dedup describegpt diff edit enum excel exclude extdedup extsort explode fetch fetchpost fill fixlengths flatten fmt foreach frequency geocode headers index input join joinp json jsonl lens luau partition pro prompt pseudo py rename replace reverse safenames sample schema search searchset select slice snappy sniff sort sortcheck split sqlp stats table to tojsonl transpose validate help"
opts="apply behead cat clipboard count datefmt dedup describegpt diff edit enum excel exclude extdedup extsort explode fetch fetchpost fill fixlengths flatten fmt foreach frequency geocode headers index input join joinp json jsonl lens luau partition pro prompt pseudo py rename replace reverse safenames sample schema search searchset select slice snappy sniff sort sortcheck split sqlp stats table template to tojsonl transpose validate help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -2859,6 +2865,20 @@ _qsv() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
qsv__help__template)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
qsv__help__to)
opts="postgres sqlite xlsx datapackage"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand Down Expand Up @@ -3797,6 +3817,20 @@ _qsv() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
qsv__template)
opts="-h --template --template-file --outfilename --customfilter-error --output --no-headers --delimiter --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
qsv__to)
opts="-h --print-package --dump --stats --stats-csv --quiet --schema --drop --evolve --pipe --separator --jobs --delimiter --help postgres sqlite xlsx datapackage help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down
16 changes: 16 additions & 0 deletions contrib/completions/examples/qsv.elv
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ set edit:completion:arg-completer[qsv] = {|@words|
cand sqlp 'sqlp'
cand stats 'stats'
cand table 'table'
cand template 'template'
cand to 'to'
cand tojsonl 'tojsonl'
cand transpose 'transpose'
Expand Down Expand Up @@ -440,6 +441,7 @@ set edit:completion:arg-completer[qsv] = {|@words|
cand --help 'Print help'
}
&'qsv;fetchpost'= {
cand --payload-tpl 'payload-tpl'
cand --new-column 'new-column'
cand --jaq 'jaq'
cand --jaqfile 'jaqfile'
Expand Down Expand Up @@ -1457,6 +1459,17 @@ set edit:completion:arg-completer[qsv] = {|@words|
cand -h 'Print help'
cand --help 'Print help'
}
&'qsv;template'= {
cand --template 'template'
cand --template-file 'template-file'
cand --outfilename 'outfilename'
cand --customfilter-error 'customfilter-error'
cand --output 'output'
cand --no-headers 'no-headers'
cand --delimiter 'delimiter'
cand -h 'Print help'
cand --help 'Print help'
}
&'qsv;to'= {
cand --print-package 'print-package'
cand --dump 'dump'
Expand Down Expand Up @@ -1654,6 +1667,7 @@ set edit:completion:arg-completer[qsv] = {|@words|
cand sqlp 'sqlp'
cand stats 'stats'
cand table 'table'
cand template 'template'
cand to 'to'
cand tojsonl 'tojsonl'
cand transpose 'transpose'
Expand Down Expand Up @@ -1855,6 +1869,8 @@ set edit:completion:arg-completer[qsv] = {|@words|
}
&'qsv;help;table'= {
}
&'qsv;help;template'= {
}
&'qsv;help;to'= {
cand postgres 'postgres'
cand sqlite 'sqlite'
Expand Down
36 changes: 36 additions & 0 deletions contrib/completions/examples/qsv.fig.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,9 @@ const completion: Fig.Spec = {
{
name: "fetchpost",
options: [
{
name: "--payload-tpl",
},
{
name: "--new-column",
},
Expand Down Expand Up @@ -3572,6 +3575,36 @@ const completion: Fig.Spec = {
},
],
},
{
name: "template",
options: [
{
name: "--template",
},
{
name: "--template-file",
},
{
name: "--outfilename",
},
{
name: "--customfilter-error",
},
{
name: "--output",
},
{
name: "--no-headers",
},
{
name: "--delimiter",
},
{
name: ["-h", "--help"],
description: "Print help",
},
],
},
{
name: "to",
subcommands: [
Expand Down Expand Up @@ -4193,6 +4226,9 @@ const completion: Fig.Spec = {
{
name: "table",
},
{
name: "template",
},
{
name: "to",
subcommands: [
Expand Down
Loading

0 comments on commit 8b5cd86

Please sign in to comment.