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
26 lines (22 loc) · 785 Bytes
/
Copy pathversion.go
File metadata and controls
26 lines (22 loc) · 785 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
package cmd
import (
"context"
"fmt"
"github.com/railwayapp/cli/constants"
"github.com/railwayapp/cli/entity"
"github.com/railwayapp/cli/ui"
)
func (h *Handler) Version(ctx context.Context, req *entity.CommandRequest) error {
fmt.Printf("railway version %s\n", ui.MagentaText(constants.Version))
return nil
}
func (h *Handler) CheckVersion(ctx context.Context, req *entity.CommandRequest) error {
if constants.Version != constants.VersionDefault {
latest, _ := h.ctrl.GetLatestVersion()
// Suppressing error as getting latest version is desired, not required
if latest != "" && latest[1:] != constants.Version {
fmt.Println(ui.Bold(fmt.Sprintf("A newer version of the Railway CLI is available, please update to: %s", ui.MagentaText(latest))))
}
}
return nil
}