forked from kedgeproject/kedge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kedge <subcommand> errors out without -f/--files
Before this commit, running `kedge` subcommands without passing any files would do nothing. $ kedge deploy $ $ kedge generate $ $ kedge undeploy $ This commit adds a check that input files are passed using -f or --files flags, and if not, throws an error. $ kedge generate Error: Unable to validate input files: No files were passed. Please pass file(s) using '-f' or '--files' The flags have also been marked as required, however, that takes no effect, and there is an open issue on the spf13/cobra package tracking the same - spf13/cobra#206 Fixes kedgeproject#96
- Loading branch information
Showing
4 changed files
with
32 additions
and
2 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
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package cmd | ||
|
||
import "github.com/pkg/errors" | ||
|
||
func validateFiles(files []string) error { | ||
if len(files) == 0 { | ||
return errors.New("No files were passed. Please pass file(s) using '-f' or '--files'") | ||
} | ||
return nil | ||
} |