feat(healthcheck): better cli args
This commit is contained in:
parent
e2d5369891
commit
621415b71f
|
@ -39,16 +39,17 @@ var Version string
|
||||||
|
|
||||||
// Generally, err is used for runtime errors, and checkRes is used for the result of the checks.
|
// Generally, err is used for runtime errors, and checkRes is used for the result of the checks.
|
||||||
func main() {
|
func main() {
|
||||||
// TODO: remove gitWhitelist, it is only for backward compatibility now
|
var metaFile []string
|
||||||
var gitWhitelist, metaFile []string
|
|
||||||
showVersion := flag.Bool("version", false, "print current version")
|
showVersion := flag.Bool("version", false, "print current version")
|
||||||
rootDir := flag.String("root", "", "")
|
rootDir := flag.String("root", ".", "root dir for forbidden files check")
|
||||||
size := flag.Float64("repoSize", 2, "maximum size of the repo in MiB")
|
repoSize := flag.Float64("repoSize", 2, "maximum size of the repo in MiB")
|
||||||
localList := flag.String("localList", "", "")
|
localList := flag.String("localList", "", "local file list for non-ascii file check")
|
||||||
checkFileNameList := flag.String("checkFileNameList", "", "Comma-separated list of files to check.")
|
checkFileNameList := flag.String("checkFileNameList", "", "comma-separated list of files to check")
|
||||||
checkFileSumList := flag.String("checkFileSumList", "", "Comma-separated list of expected checksums.")
|
checkFileSumList := flag.String("checkFileSumList", "", "comma-separated list of expected checksums")
|
||||||
parseMultiValueFlag(&gitWhitelist, "whitelist", "")
|
parseMultiValueFlag(&metaFile, "meta", "meta files to check")
|
||||||
parseMultiValueFlag(&metaFile, "meta", "")
|
// TODO: remove gitWhitelist, it is only for backward compatibility now
|
||||||
|
var gitWhitelist []string
|
||||||
|
parseMultiValueFlag(&gitWhitelist, "whitelist", "[DEPRECATED] will be ignored")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if *showVersion {
|
if *showVersion {
|
||||||
fmt.Println(Version)
|
fmt.Println(Version)
|
||||||
|
@ -57,14 +58,14 @@ func main() {
|
||||||
setupSlog()
|
setupSlog()
|
||||||
slog.Info("start repo-health-checker", "version", Version)
|
slog.Info("start repo-health-checker", "version", Version)
|
||||||
slog.Debug("cli args",
|
slog.Debug("cli args",
|
||||||
"repoSize", size,
|
"repoSize", repoSize,
|
||||||
"localList", localList,
|
"localList", localList,
|
||||||
"checkFileNameList", checkFileNameList,
|
"checkFileNameList", checkFileNameList,
|
||||||
"checkFileSumList", checkFileSumList,
|
"checkFileSumList", checkFileSumList,
|
||||||
"meta", metaFile,
|
"meta", metaFile,
|
||||||
)
|
)
|
||||||
var err error
|
var err error
|
||||||
err = healthcheck.RepoSize(*size)
|
err = healthcheck.RepoSize(*repoSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("### Repo Size Check Failed:\n%s\n", err.Error())
|
fmt.Printf("### Repo Size Check Failed:\n%s\n", err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user