-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from opencultureconsulting:felixlohmeier/impor…
…t-tsv-26 import tsv command
- Loading branch information
Showing
4 changed files
with
287 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# shellcheck shell=bash | ||
|
||
# call init_import function to eval args and to set basic post data | ||
init_import | ||
|
||
# check if stdin is present if selected | ||
if [[ ${args[file]} == '-' ]] || [[ ${args[file]} == '"-"' ]]; then | ||
if ! read -u 0 -t 0; then | ||
orcli_import_tsv_usage | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# assemble specific post data (some options require json format) | ||
data+=("format=text/line-based/*sv") | ||
options='{ ' | ||
options+="\"separator\": \"\\t\"" | ||
if [[ ${args[--encoding]} ]]; then | ||
options+=', ' | ||
options+="\"encoding\": \"${args[--encoding]}\"" | ||
fi | ||
if [[ ${args[--trimStrings]} ]]; then | ||
options+=', ' | ||
options+="\"trimStrings\": true" | ||
fi | ||
options+=' }' | ||
data+=("options=${options}") | ||
|
||
# call post_import function to post data and validate results | ||
post_import "${data[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters