Skip to content

Commit d386384

Browse files
feat(block): improve arguments configuration (#4275)
Co-authored-by: Jules Castéran <jcasteran@scaleway.com>
1 parent 8f0a8ea commit d386384

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

cmd/scw/testdata/test-all-usage-block-snapshot-create-usage.golden

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ USAGE:
77
scw block snapshot create [arg=value ...]
88

99
ARGS:
10-
[volume-id] UUID of the volume to snapshot
11-
[name] Name of the snapshot
12-
[project-id] Project ID to use. If none is passed the default project ID will be used
13-
[tags.{index}] List of tags assigned to the snapshot
14-
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | fr-par-3 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2 | pl-waw-3)
10+
[volume-id] UUID of the volume to snapshot
11+
[name=<generated>] Name of the snapshot
12+
[project-id] Project ID to use. If none is passed the default project ID will be used
13+
[tags.{index}] List of tags assigned to the snapshot
14+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | fr-par-3 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2 | pl-waw-3)
1515

1616
FLAGS:
1717
-h, --help help for create

cmd/scw/testdata/test-all-usage-block-snapshot-delete-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
You must specify the `snapshot_id` of the snapshot you want to delete. The snapshot must not be in use.
44

55
USAGE:
6-
scw block snapshot delete [arg=value ...]
6+
scw block snapshot delete <snapshot-id ...> [arg=value ...]
77

88
ARGS:
99
snapshot-id UUID of the snapshot

cmd/scw/testdata/test-all-usage-block-volume-create-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ USAGE:
77
scw block volume create [arg=value ...]
88

99
ARGS:
10-
name Name of the volume
10+
name=<generated> Name of the volume
1111
perf-iops The maximum IO/s expected, according to the different options available in stock (`5000 | 15000`)
1212
[project-id] Project ID to use. If none is passed the default project ID will be used
1313
[from-empty.size] Volume size in bytes, with a granularity of 1 GB (10^9 bytes)

cmd/scw/testdata/test-all-usage-block-volume-delete-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
You must specify the `volume_id` of the volume you want to delete. The volume must not be in the `in_use` status.
44

55
USAGE:
6-
scw block volume delete [arg=value ...]
6+
scw block volume delete <volume-id ...> [arg=value ...]
77

88
ARGS:
99
volume-id UUID of the volume

docs/commands/block.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ scw block snapshot create [arg=value ...]
4242
| Name | | Description |
4343
|------|---|-------------|
4444
| volume-id | | UUID of the volume to snapshot |
45-
| name | | Name of the snapshot |
45+
| name | Default: `<generated>` | Name of the snapshot |
4646
| project-id | | Project ID to use. If none is passed the default project ID will be used |
4747
| tags.{index} | | List of tags assigned to the snapshot |
4848
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `fr-par-3`, `nl-ams-1`, `nl-ams-2`, `nl-ams-3`, `pl-waw-1`, `pl-waw-2`, `pl-waw-3` | Zone to target. If none is passed will use default zone from the config |
@@ -56,7 +56,7 @@ You must specify the `snapshot_id` of the snapshot you want to delete. The snaps
5656
**Usage:**
5757

5858
```
59-
scw block snapshot delete [arg=value ...]
59+
scw block snapshot delete <snapshot-id ...> [arg=value ...]
6060
```
6161

6262

@@ -205,7 +205,7 @@ scw block volume create [arg=value ...]
205205

206206
| Name | | Description |
207207
|------|---|-------------|
208-
| name | Required | Name of the volume |
208+
| name | Required<br />Default: `<generated>` | Name of the volume |
209209
| perf-iops | Required | The maximum IO/s expected, according to the different options available in stock (`5000 | 15000`) |
210210
| project-id | | Project ID to use. If none is passed the default project ID will be used |
211211
| from-empty.size | | Volume size in bytes, with a granularity of 1 GB (10^9 bytes) |
@@ -223,7 +223,7 @@ You must specify the `volume_id` of the volume you want to delete. The volume mu
223223
**Usage:**
224224

225225
```
226-
scw block volume delete [arg=value ...]
226+
scw block volume delete <volume-id ...> [arg=value ...]
227227
```
228228

229229

internal/namespaces/block/v1alpha1/block_cli.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ To create a volume from an existing snapshot, specify ` + "`" + `from_snapshot`
197197
Required: true,
198198
Deprecated: false,
199199
Positional: false,
200+
Default: core.RandomValueGenerator("vol"),
200201
},
201202
{
202203
Name: "perf-iops",
@@ -292,7 +293,7 @@ func blockVolumeDelete() *core.Command {
292293
Short: `UUID of the volume`,
293294
Required: true,
294295
Deprecated: false,
295-
Positional: false,
296+
Positional: true,
296297
},
297298
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneFrPar3, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZoneNlAms3, scw.ZonePlWaw1, scw.ZonePlWaw2, scw.ZonePlWaw3),
298299
},
@@ -494,6 +495,7 @@ If your volume is in a transient state, you need to wait until the end of the cu
494495
Required: false,
495496
Deprecated: false,
496497
Positional: false,
498+
Default: core.RandomValueGenerator("snp"),
497499
},
498500
core.ProjectIDArgSpec(),
499501
{
@@ -636,7 +638,7 @@ func blockSnapshotDelete() *core.Command {
636638
Short: `UUID of the snapshot`,
637639
Required: true,
638640
Deprecated: false,
639-
Positional: false,
641+
Positional: true,
640642
},
641643
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneFrPar3, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZoneNlAms3, scw.ZonePlWaw1, scw.ZonePlWaw2, scw.ZonePlWaw3),
642644
},

0 commit comments

Comments
 (0)