This is an automated email from the ASF dual-hosted git repository.

warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit dd00165a3fb7690a678f5c4257512530c2b42665
Author: Nddtfjiang <[email protected]>
AuthorDate: Thu Jun 9 06:51:01 2022 +0000

    refactor: set tagslimit args to int from string
    
    Change tagsLimit to IntP from StringP
    
    Nddtfjiang <[email protected]>
---
 plugins/refdiff/refdiff.go | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/plugins/refdiff/refdiff.go b/plugins/refdiff/refdiff.go
index 8fb502e1..cec4370c 100644
--- a/plugins/refdiff/refdiff.go
+++ b/plugins/refdiff/refdiff.go
@@ -18,8 +18,6 @@ limitations under the License.
 package main
 
 import (
-       "strconv"
-
        "github.com/apache/incubator-devlake/plugins/refdiff/tasks"
        "github.com/apache/incubator-devlake/runner"
        "github.com/mitchellh/mapstructure"
@@ -96,7 +94,7 @@ func main() {
        oldRef := refdiffCmd.Flags().StringP("old-ref", "o", "", "old ref")
 
        tagsPattern := refdiffCmd.Flags().StringP("tags-pattern", "p", "", 
"tags pattern")
-       tagsLimit := refdiffCmd.Flags().StringP("tags-limit", "l", "", "tags 
limit")
+       tagsLimit := refdiffCmd.Flags().IntP("tags-limit", "l", 2, "tags limit")
        tagsOrder := refdiffCmd.Flags().StringP("tags-order", "d", "", "tags 
order")
 
        _ = refdiffCmd.MarkFlagRequired("repo-id")
@@ -104,10 +102,6 @@ func main() {
        //_ = refdiffCmd.MarkFlagRequired("old-ref")
 
        refdiffCmd.Run = func(cmd *cobra.Command, args []string) {
-               tl, err := strconv.Atoi(*tagsLimit)
-               if err != nil {
-                       panic(err)
-               }
                pairs := make([]map[string]string, 0, 1)
                if *newRef == "" && *oldRef == "" {
                        if *tagsPattern == "" {
@@ -124,7 +118,7 @@ func main() {
                        "repoId":      repoId,
                        "pairs":       pairs,
                        "tagsPattern": *tagsPattern,
-                       "tagsLimit":   tl,
+                       "tagsLimit":   *tagsLimit,
                        "tagsOrder":   *tagsOrder,
                })
        }

Reply via email to