forked from railwayapp/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion.go
More file actions
27 lines (22 loc) · 770 Bytes
/
Copy pathversion.go
File metadata and controls
27 lines (22 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package cmd
import (
"context"
"fmt"
"github.com/railwayapp/cli/constants"
"github.com/railwayapp/cli/entity"
)
func (h *Handler) Version(ctx context.Context, req *entity.CommandRequest) error {
fmt.Println(fmt.Sprintf("railway version %s", constants.Version))
return nil
}
func (h *Handler) CheckVersion(ctx context.Context, req *entity.CommandRequest) error {
if constants.Version != constants.VersionDefault {
latest, _ := h.ctrl.GetLatestVersion()
latestNoV = latest[1:]
// Surpressing error as getting latest version is desired, not required
if latest != "" && (latest != constants.Version || latestNoV != constants.Version) {
fmt.Printf("A newer version of the Railway CLI is available, please update to: %s\n", latest)
}
}
return nil
}