github.com/iron-io/functions@v0.0.0-20180820112432-d59d7d1c40b2/fn/commands/version.go (about)

     1  package commands
     2  
     3  import (
     4  	"fmt"
     5  	vers "github.com/iron-io/functions/api/version"
     6  	"github.com/iron-io/functions/fn/common"
     7  	functions "github.com/iron-io/functions_go"
     8  	"github.com/urfave/cli"
     9  )
    10  
    11  func Version() cli.Command {
    12  	r := versionCmd{VersionApi: functions.NewVersionApi()}
    13  	return cli.Command{
    14  		Name:   "version",
    15  		Usage:  "displays fn and functions daemon versions",
    16  		Action: r.version,
    17  	}
    18  }
    19  
    20  type versionCmd struct {
    21  	*functions.VersionApi
    22  }
    23  
    24  func (r *versionCmd) version(c *cli.Context) error {
    25  	r.Configuration.BasePath = common.GetBasePath("")
    26  
    27  	fmt.Println("Client version:", vers.Version)
    28  	v, _, err := r.VersionGet()
    29  	if err != nil {
    30  		return err
    31  	}
    32  	fmt.Println("Server version", v.Version)
    33  	return nil
    34  }