Skip to content

Commit f95e1db

Browse files
committed
Simplify workers link command and bump to v0.2.0
- Remove --env flag, make environment a positional argument - Change version flag from -V to -v
1 parent 1cb80fe commit f95e1db

5 files changed

Lines changed: 12 additions & 11 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "openworkers-cli"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2024"
55
license = "MIT"
66

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ ow env bind my-env DB my-db --type database
7676
ow env bind my-env ASSETS my-storage --type assets
7777

7878
# Link environment to a worker
79-
ow workers link my-api --env my-env
79+
ow workers link my-api my-env
8080

8181
ow env delete old-env
8282
```

src/commands/workers.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,12 @@ pub enum WorkersCommand {
6060
},
6161

6262
/// Link an environment to a worker (for bindings and secrets)
63-
#[command(after_help = "Examples:\n \
64-
ow workers link my-api --env production\n \
65-
ow workers link my-api -e staging")]
63+
#[command(after_help = "Example:\n ow workers link my-api my-env")]
6664
Link {
6765
/// Worker name
6866
name: String,
6967

7068
/// Environment name to link
71-
#[arg(short, long)]
7269
env: String,
7370
},
7471

src/main.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const EXAMPLES: &str = color_print::cstr!(
3030
ow env create prod <dim>Create an environment</dim>
3131
ow kv create cache <dim>Create a KV namespace</dim>
3232
ow env bind prod CACHE cache -t kv <dim>Bind KV to environment</dim>
33-
ow workers link my-api --env prod <dim>Link environment to worker</dim>
33+
ow workers link my-api my-env <dim>Link environment to worker</dim>
3434
3535
<dim># Using aliases (for multiple backends)</dim>
3636
ow alias list <dim>Show configured aliases</dim>
@@ -44,7 +44,7 @@ const EXAMPLES: &str = color_print::cstr!(
4444

4545
#[derive(Parser)]
4646
#[command(name = "ow")]
47-
#[command(author, version)]
47+
#[command(author, version, disable_version_flag = true)]
4848
#[command(about = "OpenWorkers CLI - Deploy and manage serverless workers")]
4949
#[command(
5050
long_about = "OpenWorkers CLI - Deploy and manage serverless workers.\n\n\
@@ -54,6 +54,10 @@ const EXAMPLES: &str = color_print::cstr!(
5454
)]
5555
#[command(after_help = EXAMPLES)]
5656
struct Cli {
57+
/// Print version
58+
#[arg(short = 'v', long = "version", action = clap::ArgAction::Version)]
59+
version: (),
60+
5761
#[command(subcommand)]
5862
command: Commands,
5963
}
@@ -95,7 +99,7 @@ enum Commands {
9599
ow workers create my-api Create worker 'my-api'\n \
96100
ow workers deploy my-api worker.ts Deploy TypeScript code\n \
97101
ow workers upload my-app ./dist Upload folder with assets\n \
98-
ow workers link my-api --env prod Link to environment"
102+
ow workers link my-api my-env Link to environment"
99103
)]
100104
Workers {
101105
#[command(subcommand)]
@@ -240,7 +244,7 @@ fn extract_alias_from_args() -> (Option<String>, Vec<String>) {
240244
"--help",
241245
"-h",
242246
"--version",
243-
"-V",
247+
"-v",
244248
];
245249

246250
if known_commands.contains(&potential_alias.as_str()) {

0 commit comments

Comments
 (0)