Rename to GitHub (#3)

* circle

* Rename to github and fn->cli

*  Rename to github and fn->cli
This commit is contained in:
Travis Reeder
2017-07-26 10:50:19 -07:00
committed by GitHub
parent 27b665422d
commit 48e3781d5e
9861 changed files with 213 additions and 188 deletions

47
cli/version.go Normal file
View File

@@ -0,0 +1,47 @@
package main
import (
"fmt"
"net/url"
"os"
functions "github.com/funcy/functions_go"
"github.com/urfave/cli"
)
// Version of Functions CLI
var Version = "0.3.18"
func version() cli.Command {
r := versionCmd{VersionApi: functions.NewVersionApi()}
return cli.Command{
Name: "version",
Usage: "displays fn and functions daemon versions",
Action: r.version,
}
}
type versionCmd struct {
*functions.VersionApi
}
func (r *versionCmd) version(c *cli.Context) error {
apiURL := os.Getenv("API_URL")
if apiURL == "" {
apiURL = "http://localhost:8080"
}
u, err := url.Parse(apiURL)
if err != nil {
return err
}
r.Configuration.BasePath = u.String()
fmt.Println("Client version:", Version)
v, _, err := r.VersionGet()
if err != nil {
return err
}
fmt.Println("Server version", v.Version)
return nil
}