github.com/polarismesh/polaris@v1.17.8/cmd/version.go (about)

     1  /**
     2   * Tencent is pleased to support the open source community by making Polaris available.
     3   *
     4   * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
     5   *
     6   * Licensed under the BSD 3-Clause License (the "License");
     7   * you may not use this file except in compliance with the License.
     8   * You may obtain a copy of the License at
     9   *
    10   * https://opensource.org/licenses/BSD-3-Clause
    11   *
    12   * Unless required by applicable law or agreed to in writing, software distributed
    13   * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    14   * CONDITIONS OF ANY KIND, either express or implied. See the License for the
    15   * specific language governing permissions and limitations under the License.
    16   */
    17  
    18  package cmd
    19  
    20  import (
    21  	"fmt"
    22  
    23  	"github.com/spf13/cobra"
    24  
    25  	"github.com/polarismesh/polaris/common/version"
    26  )
    27  
    28  var (
    29  	versionCmd = &cobra.Command{
    30  		Use:   "version",
    31  		Short: "print version",
    32  		Long:  "print version",
    33  		Run: func(c *cobra.Command, args []string) {
    34  			fmt.Printf("version: %v\n", version.Get())
    35  		},
    36  	}
    37  
    38  	revisionCmd = &cobra.Command{
    39  		Use:   "revision",
    40  		Short: "print revision with building date",
    41  		Long:  "print revision with building date",
    42  		Run: func(cmd *cobra.Command, args []string) {
    43  			fmt.Printf("revision: %v\n", version.GetRevision())
    44  		},
    45  	}
    46  )