forked from scaleway/scaleway-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom.go
More file actions
51 lines (43 loc) · 1.44 KB
/
custom.go
File metadata and controls
51 lines (43 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package registry
import (
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/core/human"
"github.com/scaleway/scaleway-sdk-go/api/registry/v1"
)
// GetCommands returns registry commands.
//
// This function:
// - Gets the generated commands
// - Register handwritten marshalers
// - Apply handwritten overrides (of Command.Run)
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()
cmds.MustFind("registry").Groups = []string{"container", "storage"}
cmds.Merge(core.NewCommands(
registryLoginCommand(),
registryLogoutCommand(),
registryDockerHelperGetCommand(),
registryDockerHelperEraseCommand(),
registryDockerHelperListCommand(),
registryDockerHelperStoreCommand(),
registryInstallDockerHelperCommand(),
))
cmds.MustFind("registry", "tag", "delete").Override(tagDeleteBuilder)
cmds.MustFind("registry", "tag", "get").Override(tagGetBuilder)
cmds.MustFind("registry", "tag", "list").Override(tagListBuilder)
cmds.MustFind("registry", "image", "get").Override(imageGetBuilder)
cmds.MustFind("registry", "image", "list").Override(imageListBuilder)
human.RegisterMarshalerFunc(
registry.NamespaceStatus(""),
human.EnumMarshalFunc(namespaceStatusMarshalSpecs),
)
human.RegisterMarshalerFunc(
registry.ImageStatus(""),
human.EnumMarshalFunc(imageStatusMarshalSpecs),
)
human.RegisterMarshalerFunc(
registry.TagStatus(""),
human.EnumMarshalFunc(tagStatusMarshalSpecs),
)
return cmds
}