feat: meta conf flag
All checks were successful
checks / build (push) Successful in 1m21s

This commit is contained in:
张泊明518370910136 2024-09-26 01:06:51 -04:00
parent 3a8e3dfcf4
commit 1bb0ddd253
GPG Key ID: D47306D7062CDA9D
2 changed files with 11 additions and 3 deletions

View File

@ -122,8 +122,8 @@ func parseConfFile(path string) (conf Conf, err error) {
return
}
func commitMsgToConf() (conf Conf, err error) {
metaConf, err := parseMetaConfFile("meta-conf.json")
func commitMsgToConf(metaConfPath string) (conf Conf, err error) {
metaConf, err := parseMetaConfFile(metaConfPath)
if err != nil {
return
}

View File

@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"flag"
"log/slog"
"os"
@ -70,8 +71,15 @@ func outputResult(conf Conf, results []stage.StageResult) error {
append(content, []byte("\n")...), 0o600)
}
var metaConfPath string
func init() {
flag.StringVar(&metaConfPath, "meta-conf", "meta-conf.json", "meta config file path")
}
func mainImpl() error {
conf, err := commitMsgToConf()
flag.Parse()
conf, err := commitMsgToConf(metaConfPath)
if err != nil {
slog.Error("no conf found", "error", err)
return err