fix(cmd/joj): show valid scopes on wrong message
This commit is contained in:
parent
e1e4fded28
commit
d0b1341af0
|
@ -164,15 +164,10 @@ func ParseMsg(confRoot, confName, msg string) (conf Conf, group string, err erro
|
|||
return
|
||||
}
|
||||
|
||||
func ListValidScopes(confRoot, confName, msg string) ([]string, error) {
|
||||
conventionalCommit, err := parseConventionalCommit(msg)
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
slog.Info("conventional commit", "commit", conventionalCommit)
|
||||
func ListValidScopes(confRoot, confName string) ([]string, error) {
|
||||
confRoot = filepath.Clean(confRoot)
|
||||
validScopes := []string{}
|
||||
err = filepath.Walk(confRoot, func(path string, info os.FileInfo, err error) error {
|
||||
err := filepath.Walk(confRoot, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
slog.Error("list valid scopes", "error", err)
|
||||
return err
|
||||
|
|
|
@ -49,12 +49,13 @@ func mainImpl() error {
|
|||
if err != nil {
|
||||
slog.Error("parse msg", "error", err)
|
||||
validScopes, scopeErr := conf.ListValidScopes(
|
||||
confRoot, confName, msg)
|
||||
confRoot, confName)
|
||||
if scopeErr != nil {
|
||||
slog.Error("list valid scopes", "error", scopeErr)
|
||||
return err
|
||||
}
|
||||
slog.Info("hint: valid scopes in commit message", "scopes", validScopes)
|
||||
slog.Info("HINT: use valid scopes in commit message",
|
||||
"valid scopes", validScopes)
|
||||
return err
|
||||
}
|
||||
if err := setupSlog(confObj.LogPath); err != nil { // after conf is loaded
|
||||
|
|
Loading…
Reference in New Issue
Block a user