* Batch-move everything
* go mod tidy
* make drone
* Remove genversions
* Bump alpine image
* Revert back pkg/build/docker/build.go
* Make sure correct enterprise branch is checked out
* Add enterprise2 version
* Remove extensions
* Bump build container
* backport node 18 test fix
(cherry picked from commit 4ff03fdbfb)
* Update scripts/drone
* Add more commands
* Fix starlark link
* Copy .drone.star
* Add drone target branch for custom events
---------
32 lines
816 B
Go
32 lines
816 B
Go
package main
|
|
|
|
import "github.com/urfave/cli/v2"
|
|
|
|
// ArgCountWrapper will cause the action to fail if there were not exactly `num` args provided.
|
|
func ArgCountWrapper(num int, action cli.ActionFunc) cli.ActionFunc {
|
|
return func(ctx *cli.Context) error {
|
|
if ctx.NArg() != num {
|
|
if err := cli.ShowSubcommandHelp(ctx); err != nil {
|
|
return cli.Exit(err.Error(), 1)
|
|
}
|
|
return cli.Exit("", 1)
|
|
}
|
|
|
|
return action(ctx)
|
|
}
|
|
}
|
|
|
|
// 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)
|
|
}
|
|
}
|