1
0
Fork 0
mirror of https://github.com/kastenhq/kubestr.git synced 2024-12-14 11:57:56 +00:00

Enforce that no arguments can be passed to commands that do not use any (#112)

* Enforce 0 args for all commands that do not use args
This commit is contained in:
mmotejlek 2022-08-16 22:11:31 +02:00 committed by GitHub
parent f3243a24d1
commit 3011d43a73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,6 +38,7 @@ var (
and validate that the storage systems in place as well as run
performance tests.`,
SilenceUsage: true,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
@ -57,6 +58,7 @@ var (
Use: "fio",
Short: "Runs an fio test",
Long: `Run an fio test`,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
@ -72,6 +74,7 @@ var (
Use: "csicheck",
Short: "Runs the CSI snapshot restore check",
Long: "Validates a CSI provisioners ability to take a snapshot of an application and restore it",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
@ -83,8 +86,8 @@ var (
pvcBrowseCmd = &cobra.Command{
Use: "browse [PVC name]",
Short: "Browse the contents of a CSI PVC via file browser",
Args: cobra.ExactArgs(1),
Long: "Browse the contents of a CSI provisioned PVC by cloning the volume and mounting it with a file browser.",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return CsiPvcBrowse(context.Background(), args[0],
namespace,