用于 Uptycs 平台的 CLI,具有自动完成和语法突出显示功能。
项目描述
usql
具有自动完成和语法突出显示的 Uptycs 命令行客户端。该工具基于 dbcli 框架工作。我们在工具中使用了 Uptycs restcall
安装
如果你已经知道如何安装 python 包,那么你可以通过 pip 安装它:
你可能需要 sudo 在 linux 上。
如果要使用 pip 安装 usql,可以使用以下命令:
$ sudo pip install usql
如果要从源安装,可以使用以下命令:
$ git pull usql
$ cd usql
$ python setup.py install
用法
$ usql --help
Usage: usql -k <uptycs key file> [DATABASE]
Examples:
- usql -k mykeyfile [global|realtime|timemachine]
~/.config/usql/config首次启动时会自动创建一个配置文件。有关所有可用选项的描述,请参见文件本身。
以下是通过该工具可用的选项
+-------------+----------------------------+------------------------------------------------------------+
| Command | Shortcut | Description |
+-------------+----------------------------+------------------------------------------------------------+
| .databases | .databases | List databases. |
| .open | .open | Change to a new database. |
| .schema | .schema[+] [table] | The complete schema for the database or a single table |
| .status | \s | Show current settings. |
| .tables | \dt[+] [table] | List or describe tables. |
| \G | \G | Display current query results vertically. |
| \e | \e | Edit command with editor (uses $EDITOR). |
| \f | \f [name [args..]] | List or execute favorite queries. |
| \fd | \fd [name] | Delete a favorite query. |
| \fs | \fs name query | Save a favorite query. |
| \once | \o [-o] filename | Append next result to an output file (overwrite using -o). |
| exit | \q | Exit. |
| help | \? | Show this help. |
| nopager | \n | Disable pager, print to stdout. |
| notee | notee | Stop writing results to an output file. |
| pager | \P [command] | Set PAGER. Print the query results via PAGER. |
| prompt | \R | Change prompt format. |
| quit | \q | Quit. |
| rehash | \# | Refresh auto-completions. |
| source | \. filename | Execute commands from file. |
| system | system [command] | Execute a system shell commmand. |
| tableformat | \T | Change the table format used to output results. |
| tee | tee [-o] filename | Append all results to an output file (overwrite using -o). |
| watch | watch [seconds] [-c] query | Executes the query every [seconds] seconds (by default 5). |
+-------------+----------------------------+------------------------------------------------------------+