-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extends the kudo get command. It now supports * Get "instances", "operators", "operatorversions" and "all". * --output yaml or --output json Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
- Loading branch information
1 parent
ae5b2e9
commit ecaf66e
Showing
18 changed files
with
513 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,41 @@ | ||
package cmd | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/kudobuilder/kudo/pkg/kudoctl/cmd/get" | ||
"github.com/kudobuilder/kudo/pkg/kudoctl/env" | ||
) | ||
|
||
const getExample = ` # Get all available instances | ||
kubectl kudo get instances | ||
` | ||
|
||
// newGetCmd creates a command that lists the instances in the cluster | ||
func newGetCmd() *cobra.Command { | ||
func newGetCmd(out io.Writer) *cobra.Command { | ||
opts := get.CmdOpts{ | ||
Out: out, | ||
} | ||
|
||
getCmd := &cobra.Command{ | ||
Use: "get instances", | ||
Short: "Gets all available instances.", | ||
Example: getExample, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return get.Run(args, &Settings) | ||
client, err := env.GetClient(&Settings) | ||
if err != nil { | ||
return err | ||
} | ||
opts.Client = client | ||
opts.Namespace = Settings.Namespace | ||
|
||
return get.Run(args, opts) | ||
}, | ||
} | ||
|
||
getCmd.Flags().StringVarP(opts.Output.AsStringPtr(), "output", "o", "", "Output format for command results.") | ||
|
||
return getCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.