(Feat): Initial Commit
This commit is contained in:
37
scripts/cmd/handlers_check.go
Normal file
37
scripts/cmd/handlers_check.go
Normal file
@@ -0,0 +1,37 @@
|
||||
//go:build scripts
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"allaboutapps.dev/aw/go-starter/scripts/internal/handlers"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const (
|
||||
printAllFlag = "print-all"
|
||||
)
|
||||
|
||||
var handlersCheckCmd = &cobra.Command{
|
||||
Use: "check",
|
||||
Short: "Checks handlers vs. swagger spec.",
|
||||
Long: `Checks currently implemented handlers against swagger spec.`,
|
||||
Run: func(cmd *cobra.Command, _ []string /* args */) {
|
||||
|
||||
printAll, err := cmd.Flags().GetBool(printAllFlag)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = handlers.CheckHandlers(printAll)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
handlersCmd.AddCommand(handlersCheckCmd)
|
||||
handlersCheckCmd.Flags().Bool(printAllFlag, false, "Print only print the current implemented handlers, do not generate the file.")
|
||||
}
|
||||
Reference in New Issue
Block a user