Skip to content

Commit dd65357

Browse files
authored
Merge pull request #82 from ClickHouse/issue-81-json-output-local-commands
Add --json flag, restructure CLI modules, server --version flag, and table output
2 parents 8bb547e + 38400e5 commit dd65357

17 files changed

Lines changed: 3476 additions & 2096 deletions

File tree

.github/workflows/test-install.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
run: |
100100
./target/debug/clickhousectl local install latest
101101
# Verify a version was installed
102-
./target/debug/clickhousectl local list | grep -E "^ [0-9]"
102+
./target/debug/clickhousectl local list | grep -E "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"
103103
104104
- name: Test install minor version
105105
run: |

Cargo.lock

Lines changed: 80 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clickhousectl"
3-
version = "0.1.14"
3+
version = "0.1.15"
44
edition = "2024"
55

66
[dependencies]
@@ -23,6 +23,7 @@ chrono = "0.4.44"
2323
atty = "0.2.14"
2424
open = "5.3.3"
2525
url = "2.5.8"
26+
tabled = "0.20.0"
2627

2728
[dev-dependencies]
2829
tempfile = "3.27.0"

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ clickhousectl local remove 25.12.5.44
5959

6060
#### ClickHouse binary storage
6161

62-
ClickHouse binaries are stored in a global repository, so they can be used by multiple projects without duplicating storage. Binaries are stored in `~/.clickhousectl/`:
62+
ClickHouse binaries are stored in a global repository, so they can be used by multiple projects without duplicating storage. Binaries are stored in `~/.clickhouse/`:
6363

6464
```
65-
~/.clickhousectl/
65+
~/.clickhouse/
6666
├── versions/
6767
│ └── 25.12.5.44/
6868
│ └── clickhouse
@@ -100,12 +100,13 @@ clickhousectl local client --host remote-host --port 9000 # Connect to a specif
100100

101101
### Creating and managing ClickHouse servers
102102

103-
Start and manage ClickHouse server instances. Each server gets its own isolated data directory at `.clickhousectl/servers/<name>/data/`.
103+
Start and manage ClickHouse server instances. Each server gets its own isolated data directory at `.clickhouse/servers/<name>/data/`.
104104

105105
```bash
106106
# Start a server (runs in background by default)
107107
clickhousectl local server start # Named "default"
108108
clickhousectl local server start --name dev # Named "dev"
109+
clickhousectl local server start --version stable # Use a specific version (installs if needed, doesn't change default)
109110
clickhousectl local server start --foreground # Run in foreground (-F / --fg)
110111
clickhousectl local server start --http-port 8124 --tcp-port 9001 # Explicit ports
111112
clickhousectl local server start -- --config-file=/path/to/config.xml
@@ -127,10 +128,10 @@ clickhousectl local server remove test
127128

128129
#### Project-local data directory
129130

130-
All server data lives inside `.clickhousectl/` in your project directory:
131+
All server data lives inside `.clickhouse/` in your project directory:
131132

132133
```
133-
.clickhousectl/
134+
.clickhouse/
134135
├── .gitignore # auto-created, ignores everything
135136
├── credentials.json # cloud API credentials (if configured)
136137
└── servers/
@@ -152,7 +153,7 @@ Authenticate to ClickHouse Cloud using OAuth (browser-based) or API keys.
152153
clickhousectl cloud auth login
153154
```
154155

155-
This opens your browser for authentication via the OAuth device flow. Tokens are saved to `.clickhousectl/tokens.json` (project-local).
156+
This opens your browser for authentication via the OAuth device flow. Tokens are saved to `.clickhouse/tokens.json` (project-local).
156157

157158
### API key/secret
158159

@@ -164,7 +165,7 @@ clickhousectl cloud auth login --api-key YOUR_KEY --api-secret YOUR_SECRET
164165
clickhousectl cloud auth login --interactive
165166
```
166167

167-
Credentials are saved to `.clickhousectl/credentials.json` (project-local).
168+
Credentials are saved to `.clickhouse/credentials.json` (project-local).
168169

169170
You can also use environment variables:
170171
```bash
@@ -184,7 +185,7 @@ clickhousectl cloud auth status # Show current auth state
184185
clickhousectl cloud auth logout # Clear all saved credentials (credentials.json & tokens.json)
185186
```
186187

187-
Credential resolution order: CLI flags > OAuth tokens > `.clickhousectl/credentials.json` > environment variables.
188+
Credential resolution order: CLI flags > OAuth tokens > `.clickhouse/credentials.json` > environment variables.
188189

189190
## Cloud
190191

0 commit comments

Comments
 (0)