Skip to content

Commit

Permalink
Fix the flag type for method (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
felicianotech committed Mar 28, 2022
1 parent 2f116a5 commit 9062de8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sonar/cmd/tags_head.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

var (
filterNameFl string
method string
methodFl string

headCmd = &cobra.Command{
Use: "head <image-name>",
Expand All @@ -35,12 +35,12 @@ but SemVer is also supported.`,

for _, tag := range dockerTags {

if method == "date" {
if methodFl == "date" {

if tag.Date.After(headTag.Date) {
headTag = tag
}
} else if method == "semver" {
} else if methodFl == "semver" {

headTagV, err := semver.NewSemver(headTag.Name)
if err != nil {
Expand All @@ -62,7 +62,7 @@ but SemVer is also supported.`,
}
}

if method == "semver" {
if methodFl == "semver" {

_, err := semver.NewSemver(headTag.Name)
if err != nil {
Expand All @@ -79,7 +79,7 @@ but SemVer is also supported.`,

func init() {

headCmd.PersistentFlags().StringP("method", "m", "date", "Criteria to calculate the head tag. Supported values are 'date' (default) or 'semver'.")
headCmd.PersistentFlags().StringVarP(&methodFl, "method", "m", "date", "Criteria to calculate the head tag. Supported values are 'date' (default) or 'semver'.")
headCmd.PersistentFlags().StringVar(&filterNameFl, "filter-name", ".*", "a regex of which tag names to include")
tagsCmd.AddCommand(headCmd)
}

0 comments on commit 9062de8

Please sign in to comment.