This adds more logging in certain places, and adds logging to the CLI. It also allows for certain commands in the CLI to be used without a daemon connection, namely `init`, which previously required the daemon to be connected, but now does not since it doesnt need it.
27 lines
511 B
Go
27 lines
511 B
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
util "github.com/juls0730/flux/internal/util/cli"
|
|
"github.com/juls0730/flux/pkg/API"
|
|
)
|
|
|
|
func ListCommand(ctx CommandCtx, args []string) error {
|
|
apps, err := util.GetRequest[[]API.App](ctx.Config.DaemonURL+"/apps", ctx.Logger)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to get apps: %v", err)
|
|
}
|
|
|
|
if len(*apps) == 0 {
|
|
fmt.Println("No apps found")
|
|
return nil
|
|
}
|
|
|
|
for _, app := range *apps {
|
|
fmt.Printf("%s (%s)\n", app.Name, app.DeploymentStatus)
|
|
}
|
|
|
|
return nil
|
|
}
|