Skip to content

运行“coref-go-extractor -h”出错 #51

Closed
@h4ckm310n

Description

@h4ckm310n

并不是什么大问题,不过还是希望可以fix一下。

-h / --help用于展示usage,但是在处理-h之前,extractor就先把-h当成srcPath处理了:
(language/go/extractor/src/cli/helper.go)

configArgs := strings.Split(strings.Join(args[1:], " "), " ")
srcPath, err := filepath.Abs(configArgs[len(configArgs)-1])
if err != nil {
    log.Fatalf("Unable to resolve the absolute path: %s", err)
}
if _, err := os.Stat(srcPath); os.IsNotExist(err) {
    log.Fatalf("Source path does not exist: %s", srcPath)
}

这就导致运行时会直接报“Source path does not exist”的错误,而不是如预期那样输出usage。

解决方式:可以把-h的处理放在这之前。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions