csv/tsv option columnNames and projectTags
This commit is contained in:
parent
27ee2ef650
commit
5cf03927b6
|
@ -73,6 +73,10 @@ commands:
|
||||||
- &blankCellsAsStrings
|
- &blankCellsAsStrings
|
||||||
long: --blankCellsAsStrings
|
long: --blankCellsAsStrings
|
||||||
help: store blank cells as empty strings instead of nulls
|
help: store blank cells as empty strings instead of nulls
|
||||||
|
- &columnNames
|
||||||
|
long: --columnNames
|
||||||
|
help: set column names (comma separated)
|
||||||
|
arg: columnNames
|
||||||
- &encoding_import
|
- &encoding_import
|
||||||
long: --encoding
|
long: --encoding
|
||||||
help: set character encoding
|
help: set character encoding
|
||||||
|
@ -124,6 +128,10 @@ commands:
|
||||||
long: --projectName
|
long: --projectName
|
||||||
arg: projectName
|
arg: projectName
|
||||||
help: set a name for the OpenRefine project
|
help: set a name for the OpenRefine project
|
||||||
|
- &projectTags
|
||||||
|
long: --projectTags
|
||||||
|
help: set project tags (comma separated)
|
||||||
|
arg: projectTags
|
||||||
- *quiet
|
- *quiet
|
||||||
examples:
|
examples:
|
||||||
- orcli import csv "file"
|
- orcli import csv "file"
|
||||||
|
@ -142,9 +150,22 @@ commands:
|
||||||
args:
|
args:
|
||||||
- *file
|
- *file
|
||||||
flags:
|
flags:
|
||||||
|
- *blankCellsAsStrings
|
||||||
|
- *columnNames
|
||||||
- *encoding_import
|
- *encoding_import
|
||||||
|
- *guessCellValueTypes
|
||||||
|
- *headerLines
|
||||||
|
- *ignoreLines
|
||||||
|
- *ignoreQuoteCharacter
|
||||||
|
- *includeFileSources
|
||||||
|
- *includeArchiveFileName
|
||||||
|
- *limit
|
||||||
|
- *quoteCharacter
|
||||||
|
- *skipBlankRows
|
||||||
|
- *skipDataLines
|
||||||
- *trimStrings
|
- *trimStrings
|
||||||
- *projectName
|
- *projectName
|
||||||
|
- *projectTags
|
||||||
- *quiet
|
- *quiet
|
||||||
examples:
|
examples:
|
||||||
- orcli import tsv "file"
|
- orcli import tsv "file"
|
||||||
|
|
|
@ -23,6 +23,11 @@ if [[ ${args[--blankCellsAsStrings]} ]]; then
|
||||||
options+=', '
|
options+=', '
|
||||||
options+='"storeBlankCellsAsNulls": false'
|
options+='"storeBlankCellsAsNulls": false'
|
||||||
fi
|
fi
|
||||||
|
if [[ ${args[--columnNames]} ]]; then
|
||||||
|
IFS=',' read -ra columnNames <<< "${args[--columnNames]}"
|
||||||
|
options+=', '
|
||||||
|
options+="\"columnNames\": [ $(printf ',"'%s'"' "${columnNames[@]}" | cut -c2-) ]"
|
||||||
|
fi
|
||||||
if [[ ${args[--guessCellValueTypes]} ]]; then
|
if [[ ${args[--guessCellValueTypes]} ]]; then
|
||||||
options+=', '
|
options+=', '
|
||||||
options+='"guessCellValueTypes": true'
|
options+='"guessCellValueTypes": true'
|
||||||
|
@ -71,6 +76,11 @@ if [[ ${args[--trimStrings]} ]]; then
|
||||||
options+=', '
|
options+=', '
|
||||||
options+='"trimStrings": true'
|
options+='"trimStrings": true'
|
||||||
fi
|
fi
|
||||||
|
if [[ ${args[--projectTags]} ]]; then
|
||||||
|
IFS=',' read -ra projectTags <<< "${args[--projectTags]}"
|
||||||
|
options+=', '
|
||||||
|
options+="\"projectTags\": [ $(printf ',"'%s'"' "${projectTags[@]}" | cut -c2-) ]"
|
||||||
|
fi
|
||||||
options+=' }'
|
options+=' }'
|
||||||
data+=("options=${options}")
|
data+=("options=${options}")
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,65 @@ if [[ ${args[--encoding]} ]]; then
|
||||||
options+=', '
|
options+=', '
|
||||||
options+="\"encoding\": \"${args[--encoding]}\""
|
options+="\"encoding\": \"${args[--encoding]}\""
|
||||||
fi
|
fi
|
||||||
|
if [[ ${args[--blankCellsAsStrings]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+='"storeBlankCellsAsNulls": false'
|
||||||
|
fi
|
||||||
|
if [[ ${args[--columnNames]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+="\"columnNames\": \"[${args[--columnNames]}\"]"
|
||||||
|
fi
|
||||||
|
if [[ ${args[--guessCellValueTypes]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+='"guessCellValueTypes": true'
|
||||||
|
fi
|
||||||
|
if [[ ${args[--headerLines]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+="\"headerLines\": ${args[--headerLines]}"
|
||||||
|
fi
|
||||||
|
if [[ ${args[--ignoreLines]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+="\"ignoreLines\": ${args[--ignoreLines]}"
|
||||||
|
fi
|
||||||
|
if [[ ${args[--ignoreQuoteCharacter]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+='"processQuotes": false'
|
||||||
|
fi
|
||||||
|
if [[ ${args[--includeFileSources]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+='includeFileSources: true'
|
||||||
|
fi
|
||||||
|
if [[ ${args[--includeArchiveFileName]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+='"includeArchiveFileName": true'
|
||||||
|
fi
|
||||||
|
if [[ ${args[--limit]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+="\"limit\": ${args[--limit]}"
|
||||||
|
fi
|
||||||
|
if [[ ${args[--projectName]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+="\"projectName\": \"${args[--projectName]}\""
|
||||||
|
fi
|
||||||
|
if [[ ${args[--quoteCharacter]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+="\"quoteCharacter\": \"${args[--quoteCharacter]}\""
|
||||||
|
fi
|
||||||
|
if [[ ${args[--skipBlankRows]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+='"storeBlankRows": false'
|
||||||
|
fi
|
||||||
|
if [[ ${args[--skipDataLines]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+="\"skipDataLines\": ${args[--skipDataLines]}"
|
||||||
|
fi
|
||||||
if [[ ${args[--trimStrings]} ]]; then
|
if [[ ${args[--trimStrings]} ]]; then
|
||||||
options+=', '
|
options+=', '
|
||||||
options+="\"trimStrings\": true"
|
options+='"trimStrings": true'
|
||||||
|
fi
|
||||||
|
if [[ ${args[--projectTags]} ]]; then
|
||||||
|
options+=', '
|
||||||
|
options+="\"projectTags\": \"[${args[--projectTags]}\"]"
|
||||||
fi
|
fi
|
||||||
options+=' }'
|
options+=' }'
|
||||||
data+=("options=${options}")
|
data+=("options=${options}")
|
||||||
|
|
|
@ -35,11 +35,11 @@ send_completions() {
|
||||||
echo $' ;;'
|
echo $' ;;'
|
||||||
echo $''
|
echo $''
|
||||||
echo $' \'import csv\'*)'
|
echo $' \'import csv\'*)'
|
||||||
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--blankCellsAsStrings --encoding --guessCellValueTypes --headerLines --help --ignoreLines --ignoreQuoteCharacter --includeArchiveFileName --includeFileSources --limit --projectName --quiet --quoteCharacter --separator --skipBlankRows --skipDataLines --trimStrings -h -q")" -- "$cur" )'
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--blankCellsAsStrings --columnNames --encoding --guessCellValueTypes --headerLines --help --ignoreLines --ignoreQuoteCharacter --includeArchiveFileName --includeFileSources --limit --projectName --projectTags --quiet --quoteCharacter --separator --skipBlankRows --skipDataLines --trimStrings -h -q")" -- "$cur" )'
|
||||||
echo $' ;;'
|
echo $' ;;'
|
||||||
echo $''
|
echo $''
|
||||||
echo $' \'import tsv\'*)'
|
echo $' \'import tsv\'*)'
|
||||||
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--encoding --help --projectName --quiet --trimStrings -h -q")" -- "$cur" )'
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--blankCellsAsStrings --columnNames --encoding --guessCellValueTypes --headerLines --help --ignoreLines --ignoreQuoteCharacter --includeArchiveFileName --includeFileSources --limit --projectName --projectTags --quiet --quoteCharacter --skipBlankRows --skipDataLines --trimStrings -h -q")" -- "$cur" )'
|
||||||
echo $' ;;'
|
echo $' ;;'
|
||||||
echo $''
|
echo $''
|
||||||
echo $' \'export tsv\'*)'
|
echo $' \'export tsv\'*)'
|
||||||
|
|
Loading…
Reference in New Issue