Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CheckCmd = &cobra.Command{ Use: "check [recipe-dir]", Short: "check a directory of recipes", Long: ` The "check" subcommand checks that all recipes in a directory are valid.`, Example: `webman check ~/repos/webman-pkgs/`, Run: func(cmd *cobra.Command, args []string) { if len(args) != 1 { cmd.Help() os.Exit(0) } recipeDir, err := filepath.Abs(args[0]) utils.WebmanRecipeDir = recipeDir if err != nil { panic(err) } entries, err := os.ReadDir(filepath.Join(recipeDir, "pkgs")) if err != nil { panic(err) } else { var wg sync.WaitGroup success := true wg.Add(len(entries)) for _, recipe := range entries { recipe := recipe go func() { recipeName := recipe.Name() pkg := strings.ReplaceAll(recipeName, utils.PkgRecipeExt, "") err := CheckPkgConfig(pkg) if err != nil { var lintErr schema.ResultErrors if errors.As(err, &lintErr) { for _, le := range lintErr { color.Red("%s: %s", color.YellowString(recipeName), color.RedString("%s: %s", le.Field(), le.Description())) } } else { color.Red("%s: %s", color.YellowString(recipeName), color.RedString("%v", err)) } success = false } wg.Done() }() } wg.Wait() if !success { color.Magenta("Not all packages are valid!") os.Exit(1) } color.Green("All packages are valid!") } }, }
CheckCmd represents the remove command
Functions ¶
func CheckPkgConfig ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.