Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit: add qsv edit command #2074

Merged
merged 4 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
| [dedup](/src/cmd/dedup.rs#L2)<br>🤯🚀👆 | Remove duplicate rows (See also `extdedup`, `extsort`, `sort` & `sortcheck` commands). |
| [describegpt](/src/cmd/describegpt.rs#L2)<br>🌐🤖🪄 | Infer extended metadata about a CSV using a GPT model from [OpenAI's API](https://platform.openai.com/docs/introduction) or an LLM from another API compatible with the OpenAI API specification such as [Ollama](https://ollama.com) or [Jan](https://jan.ai). |
| [diff](/src/cmd/diff.rs#L2)<br>🚀 | Find the difference between two CSVs with ludicrous speed!<br/>e.g. _compare two CSVs with 1M rows x 9 columns in under 600ms!_ |
| [edit](/src/cmd/edit.rs#L2) | Replace the value of a cell specified by its row and column. |
| [enum](/src/cmd/enumerate.rs#L2)<br>👆 | Add a new column enumerating rows by adding a column of incremental or uuid identifiers. Can also be used to copy a column or fill a new column with a constant value. |
| [excel](/src/cmd/excel.rs#L2)<br>🚀 | Exports a specified Excel/ODS sheet to a CSV file. |
| [exclude](/src/cmd/exclude.rs#L2)<br>📇👆 | Removes a set of CSV data from another set based on the specified columns. |
Expand Down
38 changes: 36 additions & 2 deletions contrib/completions/examples/qsv.bash
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ _qsv() {
qsv,diff)
cmd="qsv__diff"
;;
qsv,edit)
cmd="qsv__edit"
;;
qsv,enum)
cmd="qsv__enum"
;;
Expand Down Expand Up @@ -270,6 +273,9 @@ _qsv() {
qsv__help,diff)
cmd="qsv__help__diff"
;;
qsv__help,edit)
cmd="qsv__help__edit"
;;
qsv__help,enum)
cmd="qsv__help__enum"
;;
Expand Down Expand Up @@ -490,7 +496,7 @@ _qsv() {

case "${cmd}" in
qsv)
opts="-h --list --envlist --update --updatenow --version --help apply behead cat clipboard count datefmt dedup describegpt diff enum excel exclude extdedup extsort explode fetch fetchpost fill fixlengths flatten fmt foreach frequency geocode headers index input join joinp json jsonl luau partition 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 luau partition 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"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -881,6 +887,20 @@ _qsv() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
qsv__edit)
opts="-h --output --no-headers --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__enum)
opts="-h --new-column --start --increment --constant --copy --uuid4 --uuid7 --hash --output --no-headers --delimiter --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down Expand Up @@ -1106,7 +1126,7 @@ _qsv() {
return 0
;;
qsv__help)
opts="apply behead cat clipboard count datefmt dedup describegpt diff enum excel exclude extdedup extsort explode fetch fetchpost fill fixlengths flatten fmt foreach frequency geocode headers index input join joinp json jsonl luau partition 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 luau partition 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"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -1343,6 +1363,20 @@ _qsv() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
qsv__help__edit)
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__enum)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand Down
10 changes: 10 additions & 0 deletions contrib/completions/examples/qsv.elv
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ set edit:completion:arg-completer[qsv] = {|@words|
cand dedup 'dedup'
cand describegpt 'describegpt'
cand diff 'diff'
cand edit 'edit'
cand enum 'enum'
cand excel 'excel'
cand exclude 'exclude'
Expand Down Expand Up @@ -271,6 +272,12 @@ set edit:completion:arg-completer[qsv] = {|@words|
cand -h 'Print help'
cand --help 'Print help'
}
&'qsv;edit'= {
cand --output 'output'
cand --no-headers 'no-headers'
cand -h 'Print help'
cand --help 'Print help'
}
&'qsv;enum'= {
cand --new-column 'new-column'
cand --start 'start'
Expand Down Expand Up @@ -1012,6 +1019,7 @@ set edit:completion:arg-completer[qsv] = {|@words|
cand dedup 'dedup'
cand describegpt 'describegpt'
cand diff 'diff'
cand edit 'edit'
cand enum 'enum'
cand excel 'excel'
cand exclude 'exclude'
Expand Down Expand Up @@ -1102,6 +1110,8 @@ set edit:completion:arg-completer[qsv] = {|@words|
}
&'qsv;help;diff'= {
}
&'qsv;help;edit'= {
}
&'qsv;help;enum'= {
}
&'qsv;help;excel'= {
Expand Down
18 changes: 18 additions & 0 deletions contrib/completions/examples/qsv.fig.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,21 @@ const completion: Fig.Spec = {
},
],
},
{
name: "edit",
options: [
{
name: "--output",
},
{
name: "--no-headers",
},
{
name: ["-h", "--help"],
description: "Print help",
},
],
},
{
name: "enum",
options: [
Expand Down Expand Up @@ -2485,6 +2500,9 @@ const completion: Fig.Spec = {
{
name: "diff",
},
{
name: "edit",
},
{
name: "enum",
},
Expand Down
Loading
Loading