Skip to content

Commit

Permalink
split pre release words with "."
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoh86 committed Dec 19, 2024
1 parent 95512fe commit 7fba10e
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions internal/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,23 @@ type PreReleaseFlag []semver.PRVersion
func (f PreReleaseFlag) IsCumulative() bool { return true }

func (f *PreReleaseFlag) Set(s string) error {

v, err := semver.NewPRVersion(s)
if err != nil {
return err
words := strings.Split(s, ".")
switch len(words) {
case 0:
// noop
case 1:
v, err := semver.NewPRVersion(s)
if err != nil {
return err
}
*f = append(*f, v)
default:
for _, w := range words {
if err := f.Set(w); err != nil {
return err
}
}
}
*f = append(*f, v)
return nil
}

Expand Down

0 comments on commit 7fba10e

Please sign in to comment.