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
55 lines
1010 B
Go
55 lines
1010 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"text/tabwriter"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"gitlab.com/ghaymah/gy/internal/uit"
|
|
)
|
|
|
|
func newListCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "list",
|
|
Short: "List your apps",
|
|
Aliases: []string{"apps", "ls"},
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
c, err := requireClient()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
apps, err := c.ListApps(context.Background())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if flagJSON {
|
|
return printJSON(apps)
|
|
}
|
|
|
|
if len(apps) == 0 {
|
|
fmt.Println("No apps yet. Run `gy deploy` to ship one.")
|
|
return nil
|
|
}
|
|
|
|
w := tabwriter.NewWriter(os.Stdout, 0, 2, 2, ' ', 0)
|
|
fmt.Fprintln(w, "NAME\tSTATUS\tURL")
|
|
for _, a := range apps {
|
|
if a.Ephemeral {
|
|
continue
|
|
}
|
|
status := a.Status
|
|
if a.Hibernated {
|
|
status = "hibernated"
|
|
}
|
|
fmt.Fprintf(w, "%s\t%s\t%s\n", uit.Bold.Render(a.Name), status, a.URL())
|
|
}
|
|
return w.Flush()
|
|
},
|
|
}
|
|
return cmd
|
|
}
|