From c9352f22e7b370eaa933a790eb17d489497bf71c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Tue, 21 Apr 2026 15:56:52 +0800 Subject: [PATCH] Add SKILL.md and support --version option --- Cargo.toml | 2 +- SKILL.md | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 1 + 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 SKILL.md diff --git a/Cargo.toml b/Cargo.toml index 8f37bf0..635de87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/sundy-li/arrow_cli" edition = "2024" license = "Apache-2.0" name = "arrow_cli" -version = "0.4.0" +version = "0.4.1" [dependencies] diff --git a/SKILL.md b/SKILL.md new file mode 100644 index 0000000..3d302b1 --- /dev/null +++ b/SKILL.md @@ -0,0 +1,83 @@ +--- +name: arrow-cli +description: Use `arrow_cli` to connect to a Flight SQL server and run SQL. +--- + +# arrow_cli + +`arrow_cli` is a command-line client for connecting to a Flight SQL server and executing SQL queries. + +## Install + +```bash +cargo install arrow_cli +``` + +After installation, confirm that the binary is available: + +```bash +arrow_cli --version +``` + +## Usage + +### Execute one SQL statement and exit + +```bash +arrow_cli --host localhost --port 8900 --user admin --password abc --command "select 1" +``` + +Output: + +```text ++----------+ +| Int64(1) | ++----------+ +| 1 | ++----------+ + +1 rows in set (tickets received in 0.008 sec, rows received in 0.012 sec) +``` + +### Pipe SQL through standard input + +```bash +echo "select 1" | arrow_cli --host localhost --port 8900 --user admin --password abc +``` + +Output: + +```text +1 +``` + +### Option: print the result schema + +```bash +arrow_cli --host localhost --port 8900 --user admin --password abc --print-schema --command "select number from numbers(3);" +``` + +Output: + +```text ++----------+ +| Int64(1) | ++----------+ +| 1 | ++----------+ + +Schema { + fields: [ + Field { + name: "Int64(1)", + data_type: Int64, + }, + ], + metadata: {}, +} + +1 rows in set (tickets received in 0.008 sec, rows received in 0.010 sec) +``` + +## Other notes +- Run `arrow_cli --help` for more details \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index efd3823..62adc47 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ use clap::Parser; use tonic::transport::{ClientTlsConfig, Endpoint}; #[derive(Debug, Parser, PartialEq)] +#[command(version)] struct Args { #[clap(short = 'u', long, default_value = "root", help = "User name")] user: String,