77
88 "github.com/MakeNowJust/heredoc"
99 "github.com/odpf/salt/printer"
10+ "github.com/odpf/salt/term"
1011 stencilv1beta1 "github.com/odpf/stencil/server/odpf/stencil/v1beta1"
1112 "github.com/spf13/cobra"
1213 "google.golang.org/grpc"
@@ -17,12 +18,12 @@ func NamespaceCmd() *cobra.Command {
1718 Use : "namespace" ,
1819 Aliases : []string {"namespace" },
1920 Short : "Manage namespace" ,
20- Long : "Work with namespaces" ,
21+ Long : "Work with namespaces. " ,
2122 Example : heredoc .Doc (`
2223 $ stencil namespace list
2324 $ stencil namespace create
24- $ stencil namespace get
25- $ stencil namespace update
25+ $ stencil namespace view
26+ $ stencil namespace edit
2627 $ stencil namespace delete
2728 ` ),
2829 Annotations : map [string ]string {
@@ -55,6 +56,7 @@ func listNamespaceCmd() *cobra.Command {
5556 "group:core" : "true" ,
5657 },
5758 RunE : func (cmd * cobra.Command , args []string ) error {
59+ cs := term .NewColorScheme ()
5860 s := printer .Spin ("" )
5961 defer s .Stop ()
6062
@@ -75,14 +77,14 @@ func listNamespaceCmd() *cobra.Command {
7577
7678 s .Stop ()
7779
78- fmt .Printf (" \n Showing %d namespaces \n " , len (namespaces ))
80+ fmt .Printf (" \n Showing %[1]d of %[1]d namespaces \n \n " , len (namespaces ))
7981
80- report = append (report , []string {"NAMESPACE" })
82+ report = append (report , []string {"INDEX" , "NAMESPACE" , "FORMAT" , "COMPATIBILITY" , "DESCRIPTION" })
83+ index := 1
8184
8285 for _ , n := range namespaces {
83- report = append (report , []string {
84- n ,
85- })
86+ report = append (report , []string {cs .Greenf ("#%02d" , index ), n , "-" , "-" , "-" })
87+ index ++
8688 }
8789 printer .Table (os .Stdout , report )
8890 return nil
@@ -105,7 +107,7 @@ func createNamespaceCmd() *cobra.Command {
105107 Short : "Create a namespace" ,
106108 Args : cobra .ExactArgs (1 ),
107109 Example : heredoc .Doc (`
108- $ stencil namespace create <namespace-id> --format=<schema-format> –- comp=<schema-compatibility> – -desc=<description>
110+ $ stencil namespace create <namespace-id> --format=<schema-format> -- comp=<schema-compatibility> - -desc=<description>
109111 ` ),
110112 Annotations : map [string ]string {
111113 "group:core" : "true" ,
@@ -137,7 +139,7 @@ func createNamespaceCmd() *cobra.Command {
137139
138140 spinner .Stop ()
139141
140- fmt .Printf ("namespace successfully created with id: %s" , namespace .GetId ())
142+ fmt .Printf ("Namespace successfully created with id: %s" , namespace .GetId ())
141143 return nil
142144 },
143145 }
@@ -162,11 +164,11 @@ func updateNamespaceCmd() *cobra.Command {
162164 var req stencilv1beta1.UpdateNamespaceRequest
163165
164166 cmd := & cobra.Command {
165- Use : "update " ,
166- Short : "Update a namespace" ,
167+ Use : "edit " ,
168+ Short : "Edit a namespace" ,
167169 Args : cobra .ExactArgs (1 ),
168170 Example : heredoc .Doc (`
169- $ stencil namespace update <namespace-id> –- format=<schema-format> –- comp=<schema-compatibility> – -desc=<description>
171+ $ stencil namespace edit <namespace-id> -- format=<schema-format> -- comp=<schema-compatibility> - -desc=<description>
170172 ` ),
171173 Annotations : map [string ]string {
172174 "group:core" : "true" ,
@@ -196,7 +198,7 @@ func updateNamespaceCmd() *cobra.Command {
196198
197199 spinner .Stop ()
198200
199- fmt .Printf ("namespace successfully updated" )
201+ fmt .Printf ("Namespace successfully updated" )
200202 return nil
201203 },
202204 }
@@ -221,11 +223,11 @@ func getNamespaceCmd() *cobra.Command {
221223 var req stencilv1beta1.GetNamespaceRequest
222224
223225 cmd := & cobra.Command {
224- Use : "get " ,
226+ Use : "view " ,
225227 Short : "View a namespace" ,
226228 Args : cobra .ExactArgs (1 ),
227229 Example : heredoc .Doc (`
228- $ stencil namespace get <namespace-id>
230+ $ stencil namespace view <namespace-id>
229231 ` ),
230232 Annotations : map [string ]string {
231233 "group:core" : "true" ,
@@ -310,7 +312,7 @@ func deleteNamespaceCmd() *cobra.Command {
310312
311313 spinner .Stop ()
312314
313- fmt .Printf ("namespace successfully deleted" )
315+ fmt .Printf ("Namespace successfully deleted" )
314316
315317 return nil
316318 },
0 commit comments