mirror of
https://github.com/thegeeklab/git-sv.git
synced 2024-11-10 02:10:38 +00:00
feat: prompt select for scope if scope.values is defined
This commit is contained in:
parent
3aa2ecc487
commit
d88d185b2b
@ -270,7 +270,7 @@ func commitHandler(cfg Config, git sv.Git, messageProcessor sv.MessageProcessor)
|
||||
return err
|
||||
}
|
||||
|
||||
scope, err := promptScope()
|
||||
scope, err := promptScope(cfg.CommitMessage.Scope.Values)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -46,7 +46,14 @@ func promptType() (commitType, error) {
|
||||
return items[i], nil
|
||||
}
|
||||
|
||||
func promptScope() (string, error) {
|
||||
func promptScope(values []string) (string, error) {
|
||||
if len(values) > 0 {
|
||||
selected, err := promptSelect("scope", values, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return values[selected], nil
|
||||
}
|
||||
return promptText("scope", "^[a-z0-9-]*$", "")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user