mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-30 19:09:34 -06:00
Rename ArgParser.TooManyArgsError to TooManyArgsErrorFunc
This commit is contained in:
@@ -157,7 +157,7 @@ func CreateConflictsResolveArgParser() *argparser.ArgParser {
|
||||
|
||||
func CreateMergeArgParser() *argparser.ArgParser {
|
||||
ap := argparser.NewArgParserWithMaxArgs("merge", 1)
|
||||
ap.TooManyArgsError = func(receivedArgs []string) error {
|
||||
ap.TooManyArgsErrorFunc = func(receivedArgs []string) error {
|
||||
return fmt.Errorf("Error: Dolt does not support merging from multiple commits. You probably meant to checkout one and then merge from the other.")
|
||||
}
|
||||
ap.SupportsFlag(NoFFParam, "", "Create a merge commit even when the merge resolves as a fast-forward.")
|
||||
@@ -232,7 +232,7 @@ func CreateCheckoutArgParser() *argparser.ArgParser {
|
||||
|
||||
func CreateCherryPickArgParser() *argparser.ArgParser {
|
||||
ap := argparser.NewArgParserWithMaxArgs("cherrypick", 1)
|
||||
ap.TooManyArgsError = func(receivedArgs []string) error {
|
||||
ap.TooManyArgsErrorFunc = func(receivedArgs []string) error {
|
||||
return fmt.Errorf("cherry-picking multiple commits is not supported yet.")
|
||||
}
|
||||
return ap
|
||||
|
||||
@@ -57,7 +57,7 @@ func (cmd LsCmd) ArgParser() *argparser.ArgParser {
|
||||
|
||||
func (cmd LsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
|
||||
ap := cmd.ArgParser()
|
||||
ap.TooManyArgsError = func(receivedArgs []string) error {
|
||||
ap.TooManyArgsErrorFunc = func(receivedArgs []string) error {
|
||||
args := strings.Join(receivedArgs, ", ")
|
||||
return fmt.Errorf("Only one table may be provided at a time. Received %d: %s", len(receivedArgs), args)
|
||||
}
|
||||
|
||||
@@ -49,12 +49,12 @@ func ValidatorFromStrList(paramName string, validStrList []string) ValidationFun
|
||||
}
|
||||
|
||||
type ArgParser struct {
|
||||
Name string
|
||||
MaxArgs int
|
||||
TooManyArgsError func(receivedArgs []string) error
|
||||
Supported []*Option
|
||||
nameOrAbbrevToOpt map[string]*Option
|
||||
ArgListHelp [][2]string
|
||||
Name string
|
||||
MaxArgs int
|
||||
TooManyArgsErrorFunc func(receivedArgs []string) error
|
||||
Supported []*Option
|
||||
nameOrAbbrevToOpt map[string]*Option
|
||||
ArgListHelp [][2]string
|
||||
}
|
||||
|
||||
func NewArgParserWithVariableArgs(name string) *ArgParser {
|
||||
|
||||
Reference in New Issue
Block a user