File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ package cmd
2+
3+ import (
4+ "context"
5+ "fmt"
6+ "os"
7+
8+ "github.com/SwissDataScienceCenter/renku-dev-utils/pkg/github"
9+ ns "github.com/SwissDataScienceCenter/renku-dev-utils/pkg/namespace"
10+ "github.com/spf13/cobra"
11+ )
12+
13+ var namespaceCmd = & cobra.Command {
14+ Use : "namespace" ,
15+ Aliases : []string {"ns" },
16+ Short : "Print the kubernetes namespace of the current deployment" ,
17+ Run : namespaceFn ,
18+ }
19+
20+ func namespaceFn (cmd * cobra.Command , args []string ) {
21+ ctx := context .Background ()
22+
23+ cli , err := github .NewGitHubCLI ("" )
24+ if err != nil {
25+ fmt .Println (err )
26+ os .Exit (1 )
27+ }
28+ namespace , err = ns .FindCurrentNamespace (ctx , cli )
29+ if err != nil {
30+ fmt .Println (err )
31+ os .Exit (1 )
32+ }
33+
34+ fmt .Printf ("%s\n " , namespace )
35+ }
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ func init() {
3434 rootCmd .AddCommand (cleanupDeploymentCmd )
3535 rootCmd .AddCommand (copyKeycloakAdminPasswordCmd )
3636 rootCmd .AddCommand (makeMeAdminCmd )
37+ rootCmd .AddCommand (namespaceCmd )
3738 rootCmd .AddCommand (openDeploymentCmd )
3839 rootCmd .AddCommand (versionCmd )
3940}
You can’t perform that action at this time.
0 commit comments