mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 10:42:20 +08:00

* WIP: copy approach * Fix package name * Do not ignore .keep for frontend extensions * Add keep file for frontend extensions * Tweak makefile to generate enterprise swagger or not * Remove duplicate imports * Add build extensions * Add CMD extensions * Add keep to e2e extensions * Add .keep * Reduce file structure changes * Ignore boring crypto * Add e2e extensions keep file * Remove enterprise file * Update .gitignore * Move things around * Update git ignore * Consolidate backend extensions folder * Move enterprise deps * Update comment * Do not use build tags * Ignore setting enterprise * Revert changes in makefile * Revert package changes * Add back extensions main.go * Update git ignore * Ignore spanner tests * Trick ignore files only by git * Add .ignore file to CODEOWNERS for frontend-ops * Fix issue with noisy duplicate targets
18 lines
432 B
Go
18 lines
432 B
Go
package util
|
|
|
|
import "github.com/urfave/cli/v2"
|
|
|
|
// ArgCountWrapper will cause the action to fail if there were more than `num` args provided.
|
|
func MaxArgCountWrapper(max int, action cli.ActionFunc) cli.ActionFunc {
|
|
return func(ctx *cli.Context) error {
|
|
if ctx.NArg() > max {
|
|
if err := cli.ShowSubcommandHelp(ctx); err != nil {
|
|
return cli.Exit(err.Error(), 1)
|
|
}
|
|
return cli.Exit("", 1)
|
|
}
|
|
|
|
return action(ctx)
|
|
}
|
|
}
|