ci / build (push) Canceled after 0s
Commands: login/logout/whoami, deploy (TUI + plain/JSON/CI), logs, status, open, list, version. - deploy pipeline: tar.gz source (gitignore/dockerignore aware) -> presigned upload -> cloud kaniko/buildpacks build -> live URL - bubbletea/lipgloss TUI with upload progress + live log streaming; auto-falls-back to plain output in CI - apiclient against the gateway /v1/deployments + /v1/apps endpoints - GitHub Action (action.yml) + example workflow + install script
67 lines
1.5 KiB
Go
67 lines
1.5 KiB
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/charmbracelet/lipgloss"
|
|
"github.com/spf13/cobra"
|
|
|
|
"gitlab.com/ghaymah/gy/internal/uit"
|
|
)
|
|
|
|
func newStatusCmd() *cobra.Command {
|
|
var name string
|
|
cmd := &cobra.Command{
|
|
Use: "status",
|
|
Short: "Show the linked app's status and URL",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
c, err := requireClient()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
app, err := resolveApp(c, cwd(), name)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
statusDot := uit.Ok.Render("●")
|
|
status := app.Status
|
|
switch app.Status {
|
|
case "error", "failed":
|
|
statusDot = uit.Err.Render("●")
|
|
case "running", "ready", "succeeded":
|
|
statusDot = uit.Ok.Render("●")
|
|
default:
|
|
statusDot = uit.Warn.Render("●")
|
|
if status == "" {
|
|
status = "pending"
|
|
}
|
|
}
|
|
if app.Hibernated {
|
|
statusDot = uit.Dim.Render("●")
|
|
status = "hibernated"
|
|
}
|
|
|
|
url := app.URL()
|
|
if url == "" {
|
|
url = uit.Dim.Render("(no public URL yet)")
|
|
} else {
|
|
url = uit.URL.Render(url)
|
|
}
|
|
|
|
fmt.Println(lipgloss.JoinVertical(lipgloss.Left,
|
|
uit.AppName.Render(app.Name),
|
|
uit.Dim.Render("─────"),
|
|
fmt.Sprintf("%s %s", statusDot, status),
|
|
"",
|
|
fmt.Sprintf("url %s", url),
|
|
fmt.Sprintf("image %s", app.Image),
|
|
fmt.Sprintf("instances %d", app.Instances),
|
|
))
|
|
return nil
|
|
},
|
|
}
|
|
cmd.Flags().StringVar(&name, "name", "", "app name (defaults to the linked app)")
|
|
return cmd
|
|
}
|