mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-20 03:00:43 -05:00
Merge pull request #6600 from dolthub/steph/log-argparser
Separate out log arg parsers
This commit is contained in:
@@ -281,16 +281,19 @@ func CreateVerifyConstraintsArgParser(name string) *argparser.ArgParser {
|
||||
return ap
|
||||
}
|
||||
|
||||
func CreateLogArgParser() *argparser.ArgParser {
|
||||
func CreateLogArgParser(isTableFunction bool) *argparser.ArgParser {
|
||||
ap := argparser.NewArgParserWithVariableArgs("log")
|
||||
ap.SupportsInt(NumberFlag, "n", "num_commits", "Limit the number of commits to output.")
|
||||
ap.SupportsInt(MinParentsFlag, "", "parent_count", "The minimum number of parents a commit must have to be included in the log.")
|
||||
ap.SupportsFlag(MergesFlag, "", "Equivalent to min-parents == 2, this will limit the log to commits with 2 or more parents.")
|
||||
ap.SupportsFlag(ParentsFlag, "", "Shows all parents of each commit in the log.")
|
||||
ap.SupportsString(DecorateFlag, "", "decorate_fmt", "Shows refs next to commits. Valid options are short, full, no, and auto")
|
||||
ap.SupportsFlag(OneLineFlag, "", "Shows logs in a compact format.")
|
||||
ap.SupportsStringList(NotFlag, "", "revision", "Excludes commits from revision.")
|
||||
ap.SupportsStringList(TablesFlag, "t", "table", "Restricts the log to commits that modified the specified tables.")
|
||||
if isTableFunction {
|
||||
ap.SupportsStringList(TablesFlag, "t", "table", "Restricts the log to commits that modified the specified tables.")
|
||||
} else {
|
||||
ap.SupportsFlag(OneLineFlag, "", "Shows logs in a compact format.")
|
||||
}
|
||||
return ap
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ func (cmd LogCmd) Docs() *cli.CommandDocumentation {
|
||||
}
|
||||
|
||||
func (cmd LogCmd) ArgParser() *argparser.ArgParser {
|
||||
return cli.CreateLogArgParser()
|
||||
return cli.CreateLogArgParser(false)
|
||||
}
|
||||
|
||||
// Exec executes the command
|
||||
|
||||
@@ -220,7 +220,7 @@ func (ltf *LogTableFunction) addOptions(expression []sql.Expression) error {
|
||||
return err
|
||||
}
|
||||
|
||||
apr, err := cli.CreateLogArgParser().Parse(args)
|
||||
apr, err := cli.CreateLogArgParser(true).Parse(args)
|
||||
if err != nil {
|
||||
return sql.ErrInvalidArgumentDetails.New(ltf.Name(), err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user