diff --git a/internal/commands/serverstorage/attach.go b/internal/commands/serverstorage/attach.go index 7bc1da8ac..dd45ccdc8 100644 --- a/internal/commands/serverstorage/attach.go +++ b/internal/commands/serverstorage/attach.go @@ -29,7 +29,12 @@ type attachParams struct { // AttachCommand creates the "server storage attach" command func AttachCommand() commands.Command { return &attachCommand{ - BaseCommand: commands.New("attach", "Attach a storage as a device to a server", ""), + BaseCommand: commands.New( + "attach", + "Attach a storage as a device to a server", + "upctl server storage attach 00038afc-d526-4148-af0e-d2f1eeaded9b --storage 015899e0-0a68-4949-85bb-261a99de5fdd", + `upctl server storage attach my_server1 --storage "My Storage"`, + ), } } diff --git a/internal/commands/serverstorage/detach.go b/internal/commands/serverstorage/detach.go index cc8cb563c..d15499e2f 100644 --- a/internal/commands/serverstorage/detach.go +++ b/internal/commands/serverstorage/detach.go @@ -31,7 +31,12 @@ var defaultDetachParams = &detachParams{ // DetachCommand creates the "server storage detach" command func DetachCommand() commands.Command { return &detachCommand{ - BaseCommand: commands.New("detach", "Detaches a storage resource from a server", ""), + BaseCommand: commands.New( + "detach", + "Detaches a storage resource from a server", + "upctl server storage detach 00038afc-d526-4148-af0e-d2f1eeaded9b --address virtio:1", + "upctl server storage detach my_server1 --address virtio:2", + ), } } diff --git a/internal/commands/serverstorage/server_storage.go b/internal/commands/serverstorage/server_storage.go index af62da69d..8bacf0399 100644 --- a/internal/commands/serverstorage/server_storage.go +++ b/internal/commands/serverstorage/server_storage.go @@ -10,7 +10,7 @@ const ( // BaseServerStorageCommand creates the base "server storage" command func BaseServerStorageCommand() commands.Command { - return &serverStorageCommand{commands.New("storage", "Manage server storages", "")} + return &serverStorageCommand{commands.New("storage", "Manage server storages")} } type serverStorageCommand struct { diff --git a/internal/commands/storage/backup.go b/internal/commands/storage/backup.go index ca379d0e9..2bb71b7a6 100644 --- a/internal/commands/storage/backup.go +++ b/internal/commands/storage/backup.go @@ -5,6 +5,6 @@ import "github.com/UpCloudLtd/upcloud-cli/internal/commands" // BackupCommand creates the "storage backup" command func BackupCommand() commands.Command { return &storageCommand{ - commands.New("backup", "Manage backups", ""), + commands.New("backup", "Manage backups"), } } diff --git a/internal/commands/storage/backup_create.go b/internal/commands/storage/backup_create.go index 5b9b1e974..06032be0d 100644 --- a/internal/commands/storage/backup_create.go +++ b/internal/commands/storage/backup_create.go @@ -27,7 +27,12 @@ type createBackupParams struct { // CreateBackupCommand creates the "storage backup create" command func CreateBackupCommand() commands.Command { return &createBackupCommand{ - BaseCommand: commands.New("create", "Create backup of a storage", ""), + BaseCommand: commands.New( + "create", + "Create backup of a storage", + `upctl storage backup create 01cbea5e-eb5b-4072-b2ac-9b635120e5d8 --title "first backup"`, + `upctl storage backup create "My Storage" --title second_backup`, + ), } } diff --git a/internal/commands/storage/backup_restore.go b/internal/commands/storage/backup_restore.go index c54300cda..c884013ab 100644 --- a/internal/commands/storage/backup_restore.go +++ b/internal/commands/storage/backup_restore.go @@ -26,7 +26,12 @@ type restoreBackupParams struct { // RestoreBackupCommand creates the "storage backup restore" command func RestoreBackupCommand() commands.Command { return &restoreBackupCommand{ - BaseCommand: commands.New("restore", "Restore backup of a storage", ""), + BaseCommand: commands.New( + "restore", + "Restore backup of a storage", + "upctl storage backup restore 01177c9e-7f76-4ce4-b128-bcaa3448f7ec", + `upctl storage backup restore second_backup`, + ), } } diff --git a/internal/commands/storage/clone.go b/internal/commands/storage/clone.go index 0a3aab3ec..5e806f153 100644 --- a/internal/commands/storage/clone.go +++ b/internal/commands/storage/clone.go @@ -28,7 +28,13 @@ type cloneParams struct { // CloneCommand creates the "storage clone" command func CloneCommand() commands.Command { return &cloneCommand{ - BaseCommand: commands.New("clone", "Clone a storage", ""), + BaseCommand: commands.New( + "clone", + "Clone a storage", + "upctl storage clone 015899e0-0a68-4949-85bb-261a99de5fdd --title my_storage_clone --zone fi-hel1", + "upctl storage clone 015899e0-0a68-4949-85bb-261a99de5fdd --title my_storage_clone2 --zone pl-waw1 --tier maxiops", + `upctl storage clone "My Storage" --title my_storage_clone3 --zone pl-waw1 --tier maxiops`, + ), } } diff --git a/internal/commands/storage/create.go b/internal/commands/storage/create.go index 9a084eefa..60f4415ad 100644 --- a/internal/commands/storage/create.go +++ b/internal/commands/storage/create.go @@ -16,7 +16,12 @@ import ( // CreateCommand creates the "storage create" command func CreateCommand() commands.Command { return &createCommand{ - BaseCommand: commands.New("create", "Create a storage", ""), + BaseCommand: commands.New( + "create", + "Create a storage", + `upctl storage create --zone pl-waw1 --title "My Storage"`, + "upctl storage create --zone pl-waw1 --title my_storage --size 20 --backup-interval wed --backup-retention 4", + ), } } diff --git a/internal/commands/storage/delete.go b/internal/commands/storage/delete.go index 83d008f71..6a307cb5c 100644 --- a/internal/commands/storage/delete.go +++ b/internal/commands/storage/delete.go @@ -15,7 +15,13 @@ import ( // DeleteCommand creates the "storage delete" command func DeleteCommand() commands.Command { return &deleteCommand{ - BaseCommand: commands.New("delete", "Delete a storage", ""), + BaseCommand: commands.New( + "delete", + "Delete a storage", + "upctl storage delete 01ac5319-08ac-4e7b-81e5-3140d2bbd7d8", + "upctl storage delete 0175bb34-8aed-47ce-9290-10cc45f78601 01fcb78f-e73d-4e4d-af5a-0bd6cdba4306", + `upctl storage delete "My Storage"`, + ), } } diff --git a/internal/commands/storage/import.go b/internal/commands/storage/import.go index d2253be70..ce879f4fd 100644 --- a/internal/commands/storage/import.go +++ b/internal/commands/storage/import.go @@ -3,9 +3,6 @@ package storage import ( "errors" "fmt" - "github.com/UpCloudLtd/upcloud-cli/internal/resolver" - "github.com/UpCloudLtd/upcloud-cli/internal/ui" - "github.com/UpCloudLtd/upcloud-go-api/upcloud/request" "io" "net/url" "os" @@ -13,6 +10,10 @@ import ( "sync/atomic" "time" + "github.com/UpCloudLtd/upcloud-cli/internal/resolver" + "github.com/UpCloudLtd/upcloud-cli/internal/ui" + "github.com/UpCloudLtd/upcloud-go-api/upcloud/request" + "github.com/UpCloudLtd/upcloud-cli/internal/commands" "github.com/UpCloudLtd/upcloud-cli/internal/output" @@ -26,7 +27,7 @@ func ImportCommand() commands.Command { BaseCommand: commands.New( "import", "Import a storage from external or local source", - "", + // TODO: Add examples ), createParams: newCreateParams(), } diff --git a/internal/commands/storage/list.go b/internal/commands/storage/list.go index 610f97a0f..29ceedd0f 100644 --- a/internal/commands/storage/list.go +++ b/internal/commands/storage/list.go @@ -13,7 +13,12 @@ import ( // ListCommand creates the "storage list" command func ListCommand() commands.Command { return &listCommand{ - BaseCommand: commands.New("list", "List current storages", ""), + BaseCommand: commands.New( + "list", + "List current storages", + "upctl storage list", + "upctl storage list --all", + ), } } diff --git a/internal/commands/storage/modify.go b/internal/commands/storage/modify.go index acc2d6149..ecd267583 100644 --- a/internal/commands/storage/modify.go +++ b/internal/commands/storage/modify.go @@ -2,6 +2,7 @@ package storage import ( "fmt" + "github.com/UpCloudLtd/upcloud-cli/internal/resolver" "github.com/UpCloudLtd/upcloud-cli/internal/commands" @@ -9,11 +10,12 @@ import ( "github.com/UpCloudLtd/upcloud-cli/internal/output" "github.com/UpCloudLtd/upcloud-cli/internal/ui" + "time" + "github.com/UpCloudLtd/upcloud-go-api/upcloud" "github.com/UpCloudLtd/upcloud-go-api/upcloud/request" "github.com/UpCloudLtd/upcloud-go-api/upcloud/service" "github.com/spf13/pflag" - "time" ) type modifyCommand struct { @@ -42,7 +44,12 @@ var defaultBackupRuleParams = upcloud.BackupRule{ // ModifyCommand creates the "storage modify" command func ModifyCommand() commands.Command { return &modifyCommand{ - BaseCommand: commands.New("modify", "Modify a storage", ""), + BaseCommand: commands.New( + "modify", + "Modify a storage", + `upctl storage modify 01271548-2e92-44bb-9774-d282508cc762 --title "My Storage" --size 20`, + `upctl storage modify "My Storage" --size 25`, + ), } } diff --git a/internal/commands/storage/show.go b/internal/commands/storage/show.go index 2d32a3480..c54cf7172 100644 --- a/internal/commands/storage/show.go +++ b/internal/commands/storage/show.go @@ -1,12 +1,13 @@ package storage import ( + "strings" + "github.com/UpCloudLtd/upcloud-cli/internal/commands" "github.com/UpCloudLtd/upcloud-cli/internal/completion" "github.com/UpCloudLtd/upcloud-cli/internal/output" "github.com/UpCloudLtd/upcloud-cli/internal/resolver" "github.com/UpCloudLtd/upcloud-cli/internal/ui" - "strings" "github.com/UpCloudLtd/upcloud-go-api/upcloud/request" ) @@ -14,7 +15,13 @@ import ( // ShowCommand creates the "storage show" command func ShowCommand() commands.Command { return &showCommand{ - BaseCommand: commands.New("show", "Show storage details", ""), + BaseCommand: commands.New( + "show", + "Show storage details", + "upctl storage show 01271548-2e92-44bb-9774-d282508cc762", + "upctl storage show 01271548-2e92-44bb-9774-d282508cc762 01c60190-3a01-4108-b1c3-2e828855ccc0", + `upctl storage show "My Storage"`, + ), } } diff --git a/internal/commands/storage/storage.go b/internal/commands/storage/storage.go index 700468bdc..4cebfc841 100644 --- a/internal/commands/storage/storage.go +++ b/internal/commands/storage/storage.go @@ -2,6 +2,7 @@ package storage import ( "fmt" + "github.com/UpCloudLtd/upcloud-go-api/upcloud" "github.com/UpCloudLtd/upcloud-go-api/upcloud/request" "github.com/UpCloudLtd/upcloud-go-api/upcloud/service" @@ -19,7 +20,7 @@ var ( // BaseStorageCommand creates the base "storage" command func BaseStorageCommand() commands.Command { return &storageCommand{ - commands.New("storage", "Manage storages", ""), + commands.New("storage", "Manage storages"), } } diff --git a/internal/commands/storage/templatize.go b/internal/commands/storage/templatize.go index 920cc078c..6ef0c420d 100644 --- a/internal/commands/storage/templatize.go +++ b/internal/commands/storage/templatize.go @@ -28,7 +28,12 @@ type templatizeParams struct { // TODO: figure out consistent naming, one way or the other. func TemplatizeCommand() commands.Command { return &templatizeCommand{ - BaseCommand: commands.New("templatise", "Templatise a storage", ""), + BaseCommand: commands.New( + "templatise", + "Templatise a storage", + `upctl storage templatise 01271548-2e92-44bb-9774-d282508cc762 --title "My Template"`, + `upctl storage templatise "My Storage" --title super_template`, + ), } }