orcli/orcli

5373 lines
135 KiB
Plaintext
Raw Permalink Normal View History

2022-03-25 11:16:02 +01:00
#!/usr/bin/env bash
2023-12-16 03:37:06 +01:00
# This script was generated by bashly 1.1.3 (https://bashly.dannyb.co)
2022-03-25 11:16:02 +01:00
# Modifying it manually is not recommended
2022-04-04 22:49:21 +02:00
# :wrapper.bash3_bouncer
2022-03-25 11:16:02 +01:00
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
2022-10-04 23:19:18 +02:00
printf "bash version 4 or higher is required\n" >&2
2022-03-25 11:16:02 +01:00
exit 1
fi
2022-04-04 22:49:21 +02:00
# :command.master_script
2022-03-25 11:16:02 +01:00
# :command.version_command
version_command() {
echo "$version"
}
# :command.usage
orcli_usage() {
if [[ -n $long_usage ]]; then
printf "orcli - OpenRefine command-line interface written in Bash\n"
echo
else
printf "orcli - OpenRefine command-line interface written in Bash\n"
echo
fi
printf "%s\n" "Usage:"
2022-11-14 23:46:18 +01:00
printf " orcli COMMAND\n"
2022-10-04 23:19:18 +02:00
printf " orcli [COMMAND] --help | -h\n"
2022-03-25 11:16:02 +01:00
printf " orcli --version | -v\n"
echo
# :command.usage_commands
printf "%s\n" "Commands:"
printf " %s Generate bash completions\n" "completions"
printf " %s delete OpenRefine project\n" "delete "
printf " %s commands to create OpenRefine projects from files or URLs\n" "import "
printf " %s list projects on OpenRefine server\n" "list "
printf " %s show OpenRefine project's metadata\n" "info "
2023-10-27 23:12:16 +02:00
printf " %s apply regex to each column and print matches in flattened tsv format\n" "search "
2023-12-11 11:17:46 +01:00
printf " %s commands to sort OpenRefine projects\n" "sort "
printf " %s run functional tests on tmp OpenRefine workspace\n" "test "
printf " %s apply undo/redo JSON file(s) to an OpenRefine project\n" "transform "
printf " %s commands to export data from OpenRefine projects to files\n" "export "
printf " %s run tmp OpenRefine workspace and execute shell script(s)\n" "run "
2022-03-25 11:16:02 +01:00
echo
2022-10-04 23:19:18 +02:00
# :command.long_usage
2022-03-25 11:16:02 +01:00
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
2022-10-04 23:19:18 +02:00
2022-03-25 11:16:02 +01:00
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
2022-03-25 11:16:02 +01:00
printf " Show this help\n"
echo
printf " %s\n" "--version, -v"
2022-03-25 11:16:02 +01:00
printf " Show version number\n"
echo
# :command.usage_environment_variables
printf "%s\n" "Environment Variables:"
2022-03-25 11:16:02 +01:00
# :environment_variable.usage
printf " %s\n" "OPENREFINE_URL"
2022-03-25 11:16:02 +01:00
printf " URL to OpenRefine server\n"
printf " Default: http://localhost:3333\n"
echo
2022-10-04 23:19:18 +02:00
2022-03-25 11:16:02 +01:00
# :command.usage_examples
printf "%s\n" "Examples:"
2022-04-20 12:27:53 +02:00
printf " orcli import csv \"https://git.io/fj5hF\" --projectName \"duplicates\"\n"
2022-04-14 12:06:54 +02:00
printf " orcli list\n"
2022-04-20 12:27:53 +02:00
printf " orcli info \"duplicates\"\n"
2022-11-03 22:07:08 +01:00
printf " orcli transform \"duplicates\" \"https://git.io/fj5ju\"\n"
2023-10-27 23:12:16 +02:00
printf " orcli search \"duplicates\" \"^Ben\"\n"
2023-12-11 11:17:46 +01:00
printf " orcli sort columns \"duplicates\"\n"
2022-04-20 12:27:53 +02:00
printf " orcli export tsv \"duplicates\"\n"
printf " orcli export tsv \"duplicates\" --output \"duplicates.tsv\"\n"
2023-01-15 00:43:25 +01:00
printf " orcli delete \"duplicates\"\n"
2022-10-16 23:13:59 +02:00
printf " orcli run --interactive\n"
printf " orcli run << EOF\n orcli import csv \"https://git.io/fj5hF\" --projectName \"duplicates\"\n orcli transform \"duplicates\" \"https://git.io/fj5ju\"\n orcli export tsv \"duplicates\"\n EOF\n"
2022-03-25 11:16:02 +01:00
echo
2022-10-04 23:19:18 +02:00
2022-04-04 23:00:37 +02:00
# :command.footer
printf "https://github.com/opencultureconsulting/orcli\n"
echo
2022-03-25 11:16:02 +01:00
fi
}
2022-10-04 23:19:18 +02:00
# :command.usage
orcli_completions_usage() {
if [[ -n $long_usage ]]; then
printf "orcli completions\n"
echo
2023-10-23 00:09:14 +02:00
printf " Generate bash completions\n Usage: source <(orcli completions)\n"
2022-10-04 23:19:18 +02:00
echo
else
printf "orcli completions - Generate bash completions\n"
echo
fi
printf "%s\n" "Usage:"
2022-10-04 23:19:18 +02:00
printf " orcli completions\n"
printf " orcli completions --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
2022-10-04 23:19:18 +02:00
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
2022-10-04 23:19:18 +02:00
printf " Show this help\n"
echo
fi
}
2022-12-06 15:38:20 +01:00
# :command.usage
orcli_delete_usage() {
if [[ -n $long_usage ]]; then
printf "orcli delete - delete OpenRefine project\n"
echo
else
printf "orcli delete - delete OpenRefine project\n"
echo
fi
printf "%s\n" "Usage:"
2022-12-06 15:38:20 +01:00
printf " orcli delete PROJECT [OPTIONS]\n"
printf " orcli delete --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
2022-12-06 15:38:20 +01:00
# :command.usage_flags
2022-12-13 12:05:18 +01:00
# :flag.usage
printf " %s\n" "--force, -f"
2022-12-13 12:05:18 +01:00
printf " delete all projects with the same name\n"
echo
2022-12-06 15:38:20 +01:00
# :flag.usage
printf " %s\n" "--quiet, -q"
2022-12-06 15:38:20 +01:00
printf " suppress log output, print errors only\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
2022-12-06 15:38:20 +01:00
# :command.usage_args
printf "%s\n" "Arguments:"
2022-12-06 15:38:20 +01:00
# :argument.usage
printf " %s\n" "PROJECT"
2022-12-06 15:38:20 +01:00
printf " project name or id\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
2022-12-06 15:38:20 +01:00
printf " orcli delete \"duplicates\"\n"
2023-01-15 00:43:25 +01:00
printf " orcli delete \"duplicates\" --force\n"
2022-12-06 15:38:20 +01:00
printf " orcli delete 1234567890123\n"
2023-10-23 00:09:14 +02:00
printf " for p in \$(orcli list); do orcli delete \${p:0:13}; done\n"
2022-12-06 15:38:20 +01:00
echo
fi
}
2022-04-12 12:54:16 +02:00
# :command.usage
orcli_import_usage() {
if [[ -n $long_usage ]]; then
2022-10-25 12:41:13 +02:00
printf "orcli import - commands to create OpenRefine projects from files or URLs\n"
2022-04-12 12:54:16 +02:00
echo
else
2022-10-25 12:41:13 +02:00
printf "orcli import - commands to create OpenRefine projects from files or URLs\n"
2022-04-12 12:54:16 +02:00
echo
fi
printf "%s\n" "Usage:"
2022-10-04 23:19:18 +02:00
printf " orcli import COMMAND\n"
printf " orcli import [COMMAND] --help | -h\n"
2022-04-13 13:36:23 +02:00
echo
# :command.usage_commands
printf "%s\n" "Commands:"
2023-10-28 18:07:08 +02:00
printf " %s import character-separated values (CSV)\n" "csv "
printf " %s import tab-separated values (TSV)\n" "tsv "
printf " %s import JSON\n" "json "
printf " %s import JSON Lines / newline-delimited JSON\n" "jsonl"
2022-04-12 12:54:16 +02:00
echo
2022-10-04 23:19:18 +02:00
# :command.long_usage
2022-04-12 12:54:16 +02:00
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
2022-10-04 23:19:18 +02:00
2022-04-12 12:54:16 +02:00
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
2022-04-12 12:54:16 +02:00
printf " Show this help\n"
echo
fi
}
2022-04-13 13:36:23 +02:00
# :command.usage
orcli_import_csv_usage() {
if [[ -n $long_usage ]]; then
2022-11-16 23:22:54 +01:00
printf "orcli import csv - import character-separated values (CSV)\n"
2022-04-13 13:36:23 +02:00
echo
else
2022-11-16 23:22:54 +01:00
printf "orcli import csv - import character-separated values (CSV)\n"
2022-04-13 13:36:23 +02:00
echo
fi
printf "%s\n" "Usage:"
2022-10-04 23:19:18 +02:00
printf " orcli import csv [FILE...] [OPTIONS]\n"
2022-04-13 13:36:23 +02:00
printf " orcli import csv --help | -h\n"
echo
2022-10-04 23:19:18 +02:00
# :command.long_usage
2022-04-13 13:36:23 +02:00
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
2022-10-04 23:19:18 +02:00
2022-04-13 13:36:23 +02:00
# :command.usage_flags
# :flag.usage
printf " %s\n" "--separator SEPARATOR"
2022-04-13 13:36:23 +02:00
printf " character(s) that separates columns\n"
printf " Default: ,\n"
echo
2022-12-13 23:40:10 +01:00
# :flag.usage
printf " %s\n" "--blankCellsAsStrings"
2022-12-13 23:40:10 +01:00
printf " store blank cells as empty strings instead of nulls\n"
echo
2022-04-13 13:36:23 +02:00
# :flag.usage
printf " %s\n" "--columnNames COLUMNNAMES"
2023-01-13 23:30:12 +01:00
printf " set column names (comma separated)\n hint: add --ignoreLines 1 to overwrite existing header row\n"
echo
# :flag.usage
printf " %s\n" "--encoding ENCODING"
2022-04-13 13:36:23 +02:00
printf " set character encoding\n"
echo
2022-12-13 23:40:10 +01:00
# :flag.usage
printf " %s\n" "--guessCellValueTypes"
2022-12-13 23:40:10 +01:00
printf " attempt to parse cell text into numbers\n"
echo
# :flag.usage
printf " %s\n" "--headerLines HEADERLINES"
2022-12-13 23:40:10 +01:00
printf " parse x line(s) as column headers\n"
printf " Default: 1\n"
echo
# :flag.usage
printf " %s\n" "--ignoreLines IGNORELINES"
2022-12-13 23:40:10 +01:00
printf " ignore first x line(s) at beginning of file\n"
printf " Default: -1\n"
echo
# :flag.usage
printf " %s\n" "--ignoreQuoteCharacter"
2022-12-13 23:40:10 +01:00
printf " do not use any quote character to enclose cells containing column separators\n"
echo
# :flag.usage
printf " %s\n" "--includeFileSources"
2022-12-13 23:40:10 +01:00
printf " add column with file source\n"
echo
# :flag.usage
printf " %s\n" "--includeArchiveFileName"
2022-12-13 23:40:10 +01:00
printf " add column with archive file name\n"
echo
# :flag.usage
printf " %s\n" "--limit LIMIT"
2022-12-13 23:40:10 +01:00
printf " load at most x row(s) of data\n"
printf " Default: -1\n"
echo
# :flag.usage
printf " %s\n" "--quoteCharacter QUOTECHARACTER"
2022-12-13 23:40:10 +01:00
printf " quote character to enclose cells containing column separators\n"
printf " Default: \\\"\n"
echo
# :flag.usage
printf " %s\n" "--skipBlankRows"
2022-12-13 23:40:10 +01:00
printf " do not store blank rows\n"
echo
# :flag.usage
printf " %s\n" "--skipDataLines SKIPDATALINES"
2022-12-13 23:40:10 +01:00
printf " discard initial x row(s) of data\n"
printf " Default: 0\n"
echo
2022-04-13 13:36:23 +02:00
# :flag.usage
printf " %s\n" "--trimStrings"
2022-04-13 13:36:23 +02:00
printf " trim leading & trailing whitespace from strings\n"
echo
# :flag.usage
printf " %s\n" "--projectName PROJECTNAME"
2022-04-13 13:36:23 +02:00
printf " set a name for the OpenRefine project\n"
echo
2022-04-20 12:27:53 +02:00
2022-11-14 23:46:18 +01:00
# :flag.usage
printf " %s\n" "--projectTags PROJECTTAGS"
printf " set project tags (comma separated)\n"
echo
# :flag.usage
printf " %s\n" "--quiet, -q"
2022-11-14 23:46:18 +01:00
printf " suppress log output, print errors only\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
2022-04-13 13:36:23 +02:00
# :command.usage_args
printf "%s\n" "Arguments:"
2022-04-13 13:36:23 +02:00
# :argument.usage
printf " %s\n" "FILE..."
2022-04-14 00:04:35 +02:00
printf " Path to one or more files or URLs. When FILE is -, read standard input.\n"
2022-04-13 13:36:23 +02:00
printf " Default: -\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
2022-04-20 12:27:53 +02:00
printf " orcli import csv \"file\"\n"
printf " orcli import csv \"file1\" \"file2\"\n"
2022-12-13 22:20:36 +01:00
printf " head -n 100 \"file\" | orcli import csv\n"
2022-04-20 12:27:53 +02:00
printf " orcli import csv \"https://git.io/fj5hF\"\n"
2023-10-23 00:09:14 +02:00
printf " orcli import csv \"file\" \\\\\n --separator \";\" \\\\\n --columnNames \"foo,bar,baz\" \\\\\n --ignoreLines 1 \\\\\n --encoding \"ISO-8859-1\" \\\\\n --limit 100 \\\\\n --trimStrings \\\\\n --projectName \"duplicates\" \\\\\n --projectTags \"test,urgent\"\n"
2022-04-13 13:36:23 +02:00
echo
fi
}
2022-11-16 23:22:54 +01:00
# :command.usage
orcli_import_tsv_usage() {
if [[ -n $long_usage ]]; then
printf "orcli import tsv - import tab-separated values (TSV)\n"
echo
else
printf "orcli import tsv - import tab-separated values (TSV)\n"
echo
fi
printf "%s\n" "Usage:"
2022-11-16 23:22:54 +01:00
printf " orcli import tsv [FILE...] [OPTIONS]\n"
printf " orcli import tsv --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
2022-11-16 23:22:54 +01:00
# :command.usage_flags
# :flag.usage
printf " %s\n" "--blankCellsAsStrings"
printf " store blank cells as empty strings instead of nulls\n"
echo
# :flag.usage
printf " %s\n" "--columnNames COLUMNNAMES"
2023-01-13 23:30:12 +01:00
printf " set column names (comma separated)\n hint: add --ignoreLines 1 to overwrite existing header row\n"
echo
# :flag.usage
printf " %s\n" "--encoding ENCODING"
2022-11-16 23:22:54 +01:00
printf " set character encoding\n"
echo
# :flag.usage
printf " %s\n" "--guessCellValueTypes"
printf " attempt to parse cell text into numbers\n"
echo
# :flag.usage
printf " %s\n" "--headerLines HEADERLINES"
printf " parse x line(s) as column headers\n"
printf " Default: 1\n"
echo
# :flag.usage
printf " %s\n" "--ignoreLines IGNORELINES"
printf " ignore first x line(s) at beginning of file\n"
printf " Default: -1\n"
echo
# :flag.usage
printf " %s\n" "--ignoreQuoteCharacter"
printf " do not use any quote character to enclose cells containing column separators\n"
echo
# :flag.usage
printf " %s\n" "--includeFileSources"
printf " add column with file source\n"
echo
# :flag.usage
printf " %s\n" "--includeArchiveFileName"
printf " add column with archive file name\n"
echo
# :flag.usage
printf " %s\n" "--limit LIMIT"
printf " load at most x row(s) of data\n"
printf " Default: -1\n"
echo
# :flag.usage
printf " %s\n" "--quoteCharacter QUOTECHARACTER"
printf " quote character to enclose cells containing column separators\n"
printf " Default: \\\"\n"
echo
# :flag.usage
printf " %s\n" "--skipBlankRows"
printf " do not store blank rows\n"
echo
# :flag.usage
printf " %s\n" "--skipDataLines SKIPDATALINES"
printf " discard initial x row(s) of data\n"
printf " Default: 0\n"
echo
# :flag.usage
printf " %s\n" "--trimStrings"
2022-11-16 23:22:54 +01:00
printf " trim leading & trailing whitespace from strings\n"
echo
# :flag.usage
printf " %s\n" "--projectName PROJECTNAME"
2022-11-16 23:22:54 +01:00
printf " set a name for the OpenRefine project\n"
echo
# :flag.usage
printf " %s\n" "--projectTags PROJECTTAGS"
printf " set project tags (comma separated)\n"
echo
# :flag.usage
printf " %s\n" "--quiet, -q"
2022-11-16 23:22:54 +01:00
printf " suppress log output, print errors only\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
2022-11-16 23:22:54 +01:00
# :command.usage_args
printf "%s\n" "Arguments:"
2022-11-16 23:22:54 +01:00
# :argument.usage
printf " %s\n" "FILE..."
2022-11-16 23:22:54 +01:00
printf " Path to one or more files or URLs. When FILE is -, read standard input.\n"
printf " Default: -\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
2022-11-16 23:22:54 +01:00
printf " orcli import tsv \"file\"\n"
printf " orcli import tsv \"file1\" \"file2\"\n"
2022-12-13 22:20:36 +01:00
printf " head -n 100 \"file\" | orcli import tsv\n"
2023-01-27 18:04:27 +01:00
printf " orcli import tsv \"https://example.com/file.tsv\"\n"
2023-10-23 00:09:14 +02:00
printf " orcli import tsv \"file\" \\\\\n --separator \";\" \\\\\n --columnNames \"foo,bar,baz\" \\\\\n --ignoreLines 1 \\\\\n --encoding \"ISO-8859-1\" \\\\\n --limit 100 \\\\\n --trimStrings \\\\\n --projectName \"duplicates\" \\\\\n --projectTags \"test,urgent\"\n"
2022-11-16 23:22:54 +01:00
echo
fi
}
2023-10-28 18:07:08 +02:00
# :command.usage
orcli_import_json_usage() {
if [[ -n $long_usage ]]; then
printf "orcli import json - import JSON\n"
echo
else
printf "orcli import json - import JSON\n"
echo
fi
printf "%s\n" "Usage:"
printf " orcli import json [FILE...] [OPTIONS]\n"
printf " orcli import json --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_flags
# :flag.usage
printf " %s\n" "--recordPath JSON"
printf " specify record path elements in JSON array\n"
printf " Default: [ \"_\" , \"_\" ]\n"
echo
2023-10-28 23:37:02 +02:00
# :flag.usage
printf " %s\n" "--rename"
printf " rename columns after import to remove record path fragments\n"
echo
2023-10-28 18:07:08 +02:00
# :flag.usage
printf " %s\n" "--guessCellValueTypes"
printf " attempt to parse cell text into numbers\n"
echo
# :flag.usage
printf " %s\n" "--includeFileSources"
printf " add column with file source\n"
echo
# :flag.usage
printf " %s\n" "--includeArchiveFileName"
printf " add column with archive file name\n"
echo
# :flag.usage
printf " %s\n" "--limit LIMIT"
printf " load at most x row(s) of data\n"
printf " Default: -1\n"
echo
# :flag.usage
printf " %s\n" "--storeEmptyStrings"
printf " preserve empty strings\n"
echo
# :flag.usage
printf " %s\n" "--trimStrings"
printf " trim leading & trailing whitespace from strings\n"
echo
# :flag.usage
printf " %s\n" "--projectName PROJECTNAME"
printf " set a name for the OpenRefine project\n"
echo
# :flag.usage
printf " %s\n" "--projectTags PROJECTTAGS"
printf " set project tags (comma separated)\n"
echo
# :flag.usage
printf " %s\n" "--quiet, -q"
printf " suppress log output, print errors only\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
# :command.usage_args
printf "%s\n" "Arguments:"
# :argument.usage
printf " %s\n" "FILE..."
printf " Path to one or more files or URLs. When FILE is -, read standard input.\n"
printf " Default: -\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
printf " orcli import json \"file\"\n"
printf " orcli import json \"file1\" \"file2\"\n"
printf " orcli import json \"https://example.com/file.json\"\n"
2023-10-28 23:37:02 +02:00
printf " orcli import json \"file\" \\\\\n --recordPath '[ \"_\", \"rows\", \"_\" ]' \\\\\n --rename \\\\\n --storeEmptyStrings \\\\\n --trimStrings \\\\\n --projectName \"duplicates\" \\\\\n --projectTags \"test,urgent\"\n"
2023-10-28 18:07:08 +02:00
echo
fi
}
# :command.usage
orcli_import_jsonl_usage() {
if [[ -n $long_usage ]]; then
printf "orcli import jsonl - import JSON Lines / newline-delimited JSON\n"
echo
else
printf "orcli import jsonl - import JSON Lines / newline-delimited JSON\n"
echo
fi
printf "%s\n" "Usage:"
printf " orcli import jsonl [FILE...] [OPTIONS]\n"
printf " orcli import jsonl --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_flags
2023-10-28 23:37:02 +02:00
# :flag.usage
printf " %s\n" "--rename"
printf " rename columns after import to remove record path fragments\n"
echo
2023-10-28 18:07:08 +02:00
# :flag.usage
printf " %s\n" "--guessCellValueTypes"
printf " attempt to parse cell text into numbers\n"
echo
# :flag.usage
printf " %s\n" "--includeFileSources"
printf " add column with file source\n"
echo
# :flag.usage
printf " %s\n" "--includeArchiveFileName"
printf " add column with archive file name\n"
echo
# :flag.usage
printf " %s\n" "--limit LIMIT"
printf " load at most x row(s) of data\n"
printf " Default: -1\n"
echo
# :flag.usage
printf " %s\n" "--storeEmptyStrings"
printf " preserve empty strings\n"
echo
# :flag.usage
printf " %s\n" "--trimStrings"
printf " trim leading & trailing whitespace from strings\n"
echo
# :flag.usage
printf " %s\n" "--projectName PROJECTNAME"
printf " set a name for the OpenRefine project\n"
echo
# :flag.usage
printf " %s\n" "--projectTags PROJECTTAGS"
printf " set project tags (comma separated)\n"
echo
# :flag.usage
printf " %s\n" "--quiet, -q"
printf " suppress log output, print errors only\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
# :command.usage_args
printf "%s\n" "Arguments:"
# :argument.usage
printf " %s\n" "FILE..."
printf " Path to one or more files or URLs. When FILE is -, read standard input.\n"
printf " Default: -\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
printf " orcli import jsonl \"file\"\n"
printf " orcli import jsonl \"file1\" \"file2\"\n"
printf " orcli import jsonl \"https://example.com/file.json\"\n"
2023-11-01 01:19:21 +01:00
printf " orcli import jsonl --rename <(orcli export jsonl \"duplicates\")\n"
2023-10-28 23:37:02 +02:00
printf " orcli import jsonl \"file\" \\\\\n --rename \\\\\n --storeEmptyStrings \\\\\n --trimStrings \\\\\n --projectName \"duplicates\" \\\\\n --projectTags \"test,urgent\"\n"
2023-10-28 18:07:08 +02:00
echo
fi
}
2022-03-25 11:16:02 +01:00
# :command.usage
orcli_list_usage() {
if [[ -n $long_usage ]]; then
printf "orcli list - list projects on OpenRefine server\n"
echo
else
printf "orcli list - list projects on OpenRefine server\n"
echo
fi
printf "%s\n" "Usage:"
2022-10-07 11:02:05 +02:00
printf " orcli list\n"
2022-03-25 11:16:02 +01:00
printf " orcli list --help | -h\n"
echo
2022-10-04 23:19:18 +02:00
# :command.long_usage
2022-03-25 11:16:02 +01:00
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
2022-10-04 23:19:18 +02:00
2022-03-25 11:16:02 +01:00
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
2022-03-25 11:16:02 +01:00
printf " Show this help\n"
echo
2022-10-04 23:19:18 +02:00
2022-03-25 11:16:02 +01:00
fi
}
2022-04-14 12:06:54 +02:00
# :command.usage
orcli_info_usage() {
if [[ -n $long_usage ]]; then
2022-10-25 12:41:13 +02:00
printf "orcli info - show OpenRefine project's metadata\n"
2022-04-14 12:06:54 +02:00
echo
else
2022-10-25 12:41:13 +02:00
printf "orcli info - show OpenRefine project's metadata\n"
2022-04-14 12:06:54 +02:00
echo
fi
printf "%s\n" "Usage:"
2022-10-07 11:02:05 +02:00
printf " orcli info PROJECT\n"
2022-04-14 12:06:54 +02:00
printf " orcli info --help | -h\n"
echo
2022-10-04 23:19:18 +02:00
# :command.long_usage
2022-04-14 12:06:54 +02:00
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
2022-10-04 23:19:18 +02:00
2022-04-14 12:06:54 +02:00
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
2022-04-14 12:06:54 +02:00
printf " Show this help\n"
echo
2022-10-04 23:19:18 +02:00
2022-04-14 12:06:54 +02:00
# :command.usage_args
printf "%s\n" "Arguments:"
2022-04-14 12:06:54 +02:00
# :argument.usage
printf " %s\n" "PROJECT"
2022-04-14 12:06:54 +02:00
printf " project name or id\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
2022-11-03 22:07:08 +01:00
printf " orcli info \"duplicates\"\n"
printf " orcli info 1234567890123\n"
2023-01-15 00:43:25 +01:00
printf " orcli info \"duplicates\" | jq -r .columns[]\n"
2022-11-03 22:07:08 +01:00
echo
fi
}
2023-10-27 23:12:16 +02:00
# :command.usage
orcli_search_usage() {
if [[ -n $long_usage ]]; then
printf "orcli search\n"
echo
2023-10-28 16:23:11 +02:00
printf " apply regex to each column and print matches in flattened tsv format\n output: index column value\n note that any exporter supports search by using --facets (see examples)\n"
2023-10-27 23:12:16 +02:00
echo
else
printf "orcli search - apply regex to each column and print matches in flattened tsv format\n"
echo
fi
printf "%s\n" "Usage:"
printf " orcli search PROJECT [REGEX] [OPTIONS]\n"
2023-10-27 23:12:16 +02:00
printf " orcli search --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_flags
# :flag.usage
printf " %s\n" "--index COLUMN"
printf " print column values instead of row.index in the first column of the output\n"
echo
2023-10-27 23:12:16 +02:00
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
# :command.usage_args
printf "%s\n" "Arguments:"
# :argument.usage
printf " %s\n" "PROJECT"
printf " project name or id\n"
echo
# :argument.usage
printf " %s\n" "REGEX"
printf " search term (regular expression, case-sensitive)\n"
2023-10-27 23:12:16 +02:00
echo
# :command.usage_examples
printf "%s\n" "Examples:"
printf " orcli search \"duplicates\" \"^Ben\"\n"
printf " orcli search 1234567890123 \"^Ben\"\n"
2023-10-28 16:23:11 +02:00
printf " orcli search \"duplicates\" \"^F\" --index \"email\"\n"
printf " orcli search \"duplicates\" | column -t -s \$'\t'\n"
2023-10-28 16:23:11 +02:00
printf " orcli export tsv \"duplicates\" --facets '[{ \"type\": \"list\", \"expression\":\n \"grel:filter(row.columnNames,cn,cells[cn].value.find(/^Ben/).length()>0).length()>0\",\n \"columnName\": \"\", \"selection\": [{\"v\": {\"v\": true}}] }]'\n"
printf " orcli export tsv \"duplicates\" --facets '[{ \"type\": \"list\", \"expression\":\n \"grel:filter([\\\\\"gender\\\\\",\\\\\"purchase\\\\\"],cn,cells[cn].value.find(/^F/).length()>0).length()>0\",\n \"columnName\": \"\", \"selection\": [{\"v\": {\"v\": true}}] }]'\n"
2023-10-27 23:12:16 +02:00
echo
fi
}
2023-12-11 11:17:46 +01:00
# :command.usage
orcli_sort_usage() {
if [[ -n $long_usage ]]; then
printf "orcli sort - commands to sort OpenRefine projects\n"
echo
else
printf "orcli sort - commands to sort OpenRefine projects\n"
echo
fi
printf "%s\n" "Usage:"
printf " orcli sort COMMAND\n"
printf " orcli sort [COMMAND] --help | -h\n"
echo
# :command.usage_commands
printf "%s\n" "Commands:"
printf " %s re-order columns alphabetically\n" "columns"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
fi
}
# :command.usage
orcli_sort_columns_usage() {
if [[ -n $long_usage ]]; then
printf "orcli sort columns - re-order columns alphabetically\n"
echo
else
printf "orcli sort columns - re-order columns alphabetically\n"
echo
fi
printf "%s\n" "Usage:"
printf " orcli sort columns PROJECT [OPTIONS]\n"
printf " orcli sort columns --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_flags
# :flag.usage
printf " %s\n" "--first COLUMN (repeatable)"
printf " set key column(s)\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
# :command.usage_args
printf "%s\n" "Arguments:"
# :argument.usage
printf " %s\n" "PROJECT"
printf " project name or id\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
printf " orcli sort columns \"duplicates\"\n"
printf " orcli sort columns \"duplicates\" --first name\n"
echo
fi
}
2022-11-30 23:49:54 +01:00
# :command.usage
orcli_test_usage() {
if [[ -n $long_usage ]]; then
printf "orcli test - run functional tests on tmp OpenRefine workspace\n"
echo
else
printf "orcli test - run functional tests on tmp OpenRefine workspace\n"
echo
fi
printf "%s\n" "Usage:"
2022-12-03 01:30:01 +01:00
printf " orcli test\n"
2022-11-30 23:49:54 +01:00
printf " orcli test --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
2022-11-30 23:49:54 +01:00