Skip to content

Commit 4ca6989

Browse files
committed
Add short command aliases (w, e, s, k, d)
- workers (w), env (e), storage (s), kv (k), databases (d) - Accept singular/plural variants for flexibility - Update README with shortcuts tables
1 parent 0d0592e commit 4ca6989

2 files changed

Lines changed: 62 additions & 24 deletions

File tree

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,22 @@ On first run, a `default` alias pointing to `https://dash.openworkers.com/api/v1
4343

4444
## Command Shortcuts
4545

46-
| Command | Alias | Description |
47-
|---------|-------|-------------|
48-
| `workers list` | `workers ls` | List all workers |
49-
| `workers delete` | `workers rm` | Delete a worker |
50-
| `env list` | `env ls` | List environments |
51-
| `env delete` | `env rm` | Delete environment |
52-
| `kv list` | `kv ls` | List KV namespaces |
53-
| `kv delete` | `kv rm` | Delete KV namespace |
54-
| `storage list` | `storage ls` | List storage configs |
55-
| `storage delete` | `storage rm` | Delete storage config |
56-
| `databases list` | `databases ls` | List databases |
57-
| `databases delete` | `databases rm` | Delete database |
58-
| `alias list` | `alias ls` | List aliases |
59-
| `alias remove` | `alias rm` | Remove alias |
46+
Resources:
47+
48+
| Command | Short |
49+
| ----------- | ----- |
50+
| `workers` | `w` |
51+
| `env` | `e` |
52+
| `storage` | `s` |
53+
| `kv` | `k` |
54+
| `databases` | `d` |
55+
56+
Operations:
57+
58+
| Command | Short |
59+
| -------- | ----- |
60+
| `list` | `ls` |
61+
| `delete` | `rm` |
6062

6163
## Commands
6264

src/main.rs

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,52 +87,73 @@ enum Commands {
8787
},
8888

8989
/// Create, deploy, and manage workers
90-
#[command(after_help = "Examples:\n \
90+
#[command(
91+
visible_alias = "w",
92+
alias = "worker",
93+
after_help = "Examples:\n \
9194
ow workers list List all workers\n \
9295
ow workers create my-api Create worker 'my-api'\n \
9396
ow workers deploy my-api worker.ts Deploy TypeScript code\n \
9497
ow workers upload my-app ./dist Upload folder with assets\n \
95-
ow workers link my-api --env prod Link to environment")]
98+
ow workers link my-api --env prod Link to environment"
99+
)]
96100
Workers {
97101
#[command(subcommand)]
98102
command: WorkersCommand,
99103
},
100104

101105
/// Manage environments with variables, secrets, and bindings
102-
#[command(after_help = "Examples:\n \
106+
#[command(
107+
visible_alias = "e",
108+
alias = "envs",
109+
alias = "environment",
110+
alias = "environments",
111+
after_help = "Examples:\n \
103112
ow env list List environments\n \
104113
ow env create prod Create 'prod' environment\n \
105114
ow env set prod API_KEY sk-xxx -s Set secret\n \
106115
ow env bind prod DB my-db -t database Bind database\n \
107116
ow env bind prod KV cache -t kv Bind KV namespace\n \
108-
ow env bind prod ASSETS storage -t assets Bind storage for assets")]
117+
ow env bind prod ASSETS storage -t assets Bind storage for assets"
118+
)]
109119
Env {
110120
#[command(subcommand)]
111121
command: EnvCommand,
112122
},
113123

114124
/// Manage S3/R2 storage configurations for file storage
115-
#[command(after_help = "Examples:\n \
125+
#[command(
126+
visible_alias = "s",
127+
after_help = "Examples:\n \
116128
ow storage list List storage configs\n \
117-
ow storage create my-bucket --bucket name --endpoint https://...")]
129+
ow storage create my-bucket --bucket name --endpoint https://..."
130+
)]
118131
Storage {
119132
#[command(subcommand)]
120133
command: StorageCommand,
121134
},
122135

123136
/// Manage KV namespaces for key-value storage
124-
#[command(after_help = "Examples:\n \
137+
#[command(
138+
visible_alias = "k",
139+
after_help = "Examples:\n \
125140
ow kv list List KV namespaces\n \
126-
ow kv create cache Create 'cache' namespace")]
141+
ow kv create cache Create 'cache' namespace"
142+
)]
127143
Kv {
128144
#[command(subcommand)]
129145
command: KvCommand,
130146
},
131147

132148
/// Manage SQL databases
133-
#[command(after_help = "Examples:\n \
149+
#[command(
150+
visible_alias = "d",
151+
alias = "db",
152+
alias = "database",
153+
after_help = "Examples:\n \
134154
ow databases list List databases\n \
135-
ow databases create my-db Create database")]
155+
ow databases create my-db Create database"
156+
)]
136157
Databases {
137158
#[command(subcommand)]
138159
command: DatabasesCommand,
@@ -187,6 +208,7 @@ fn extract_alias_from_args() -> (Option<String>, Vec<String>) {
187208
}
188209

189210
let known_commands = [
211+
// Main commands
190212
"alias",
191213
"login",
192214
"migrate",
@@ -196,6 +218,20 @@ fn extract_alias_from_args() -> (Option<String>, Vec<String>) {
196218
"kv",
197219
"databases",
198220
"setup-storage",
221+
// Short aliases
222+
"w",
223+
"e",
224+
"s",
225+
"k",
226+
"d",
227+
// Singular variants (for flexibility)
228+
"worker",
229+
"envs",
230+
"environment",
231+
"environments",
232+
"db",
233+
"database",
234+
// Help flags
199235
"help",
200236
"--help",
201237
"-h",

0 commit comments

Comments
 (0)