Skip to content

Commit 3c0c2a3

Browse files
authored
[fix] Handle "--help" before parsing srcPath
- Fix the problem that Go extractor wrongly handles "--help" argument as a source path
1 parent 12d2681 commit 3c0c2a3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

language/go/extractor/src/cli/helper.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ func parseExtractorRunningParams(args []string) *extractionConf {
2424
usage()
2525
os.Exit(2)
2626
}
27+
if args[1] == "-h" || args[1] == "--help" {
28+
usage()
29+
os.Exit(0)
30+
}
2731

2832
configArgs := strings.Split(strings.Join(args[1:], " "), " ")
2933
srcPath, err := filepath.Abs(configArgs[len(configArgs)-1])
@@ -42,9 +46,6 @@ func parseExtractorRunningParams(args []string) *extractionConf {
4246
for i := 0; i < len(configArgs)-1 && strings.HasPrefix(configArgs[i], "-"); i++ {
4347
arg := configArgs[i]
4448
switch arg {
45-
case "-h", "--help":
46-
usage()
47-
os.Exit(0)
4849
case "-exconfig", "-ex":
4950
handleExtractionArg(configArgs, &i, extractionConfig)
5051
case "-o", "-output", "-dbpath":

0 commit comments

Comments
 (0)