RainShellTools
RainShellTools
概述
该命令行工具提供了以下功能:
- 创建配置文件用于连接认证
create-conf
- 文件上传
upload
- 文件下载
download
$ java -jar rainTools-1.0-SNAPSHOT.jar -h
Usage: rainTools [-hV] [COMMAND]
算场 command line tools for uploading and downloading files to/from 算场
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Commands:
create-conf Create a configuration file for 算场
upload Upload a file
download Download a file
命令解释
1. create-conf
生成配置文件,用于命令行工具和服务器的连接认证。
配置文件路径为 ${HOME}/rainTools.conf
用法:
$ java -jar rainTools-1.0-SNAPSHOT.jar create-conf
Missing required options: '--accessKey=<accessKey>', '--secretKey=<secretKey>', '--endpoint=<endpoint>'
Usage: rainTools create-conf -a=<accessKey> -e=<endpoint> -s=<secretKey>
Create a configuration file for 算场
-a, --accessKey=<accessKey>
accessKey for 算场
-e, --endpoint=<endpoint>
meta endpoint for 算场
-s, --secretKey=<secretKey>
secretKey for 算场
示例:
java -jar rainTools-1.0-SNAPSHOT.jar create-conf -c 1 -d 1 -p 123456 -s 127.0.0.1:4001 -u example@suanchang.com
这样就会在${HOME}/rainTools.conf
文件中报错如下信息,用于该工具的链接认证
#算场 Configuration
#Mon Nov 25 11:51:50 CST 2024
accessKey=myAccessKey
accessSecret=mySecretKey
endpoint=127.0.0.1:4002
2. upload
将本地文件或文件夹上传到用户的算场表中
如果表不存在则会自动创建,反之则累加提交到表中
用法:
$ java -jar rainTools-1.0-SNAPSHOT.jar upload -h
Usage: rainTools upload -d=<databaseName> [-e=<csv_escape>] -f=<file>
[-q=<csv_quote>] [-s=<csv_separator>] -t=<tableName>
Upload a file
-d, --database=<databaseName>
database name
-e, --escape=<csv_escape> csv escape
-f, --file=<file> File to upload
-q, --quote=<csv_quote> csv quote
-s, --separator=<csv_separator>
csv separator
-t, --table=<tableName> table name
示例:
java -jar rainTools-1.0-SNAPSHOT.jar upload -f /home/rain/user.csv -d test -t user
这样就会将本地的/home/rain/user.csv
导入到test.user
表中
如果 -f 参数的路径为一个目录,则会将该目录下所有文件上传,实现批量上传本地文件的效果
3. download
将用户算场中的某张表的数据下载到本地,并且下载指定格式
用法:
$ java -jar rainTools-1.0-SNAPSHOT.jar download -h
Missing required options: '--file=<file>', '--database=<databaseName>', '--table=<tableName>'
Usage: rainTools download -d=<databaseName> -f=<file> -t=<tableName>
Download a file
-d, --database=<databaseName> database name to download from
-f, --file=<file> FilePath to download
-t, --table=<tableName> table name to download from
其中-f 需要指定路径到文件名,通过文件名后缀选择想要下载为的数据格式
示例:
java -jar rainTools-1.0-SNAPSHOT.jar download -f /home/rain/user.json -t test -t user
这样就会将test.user
表中的数据以json的格式下载到本地/home/rain/user.json
中