-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Reuven Harrison
authored
Sep 19, 2023
1 parent
2eb2513
commit 34d3dbf
Showing
8 changed files
with
101 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package internal | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/tufin/oasdiff/checker" | ||
) | ||
|
||
func getChecksCmd() *cobra.Command { | ||
|
||
cmd := cobra.Command{ | ||
Use: "checks [flags]", | ||
Short: "Display optional checks", | ||
Long: `Display optional checks that can be passed to 'breaking' and 'changelog' with the 'include-checks' flag`, | ||
Args: cobra.NoArgs, | ||
ValidArgsFunction: cobra.NoFileCompletions, // see https://github.com/spf13/cobra/issues/1969 | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
|
||
// by now flags have been parsed successfully so we don't need to show usage on any errors | ||
cmd.Root().SilenceUsage = true | ||
|
||
if err := runChecks(cmd.OutOrStdout()); err != nil { | ||
setReturnValue(cmd, err.Code) | ||
return err | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
return &cmd | ||
} | ||
|
||
func runChecks(stdout io.Writer) *ReturnError { | ||
if err := printYAML(stdout, checker.GetOptionalChecks()); err != nil { | ||
return getErrFailedPrint("optional checks YAML", err) | ||
} | ||
return nil | ||
} |
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
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