CLI + live dashboard wrapping aws/docker/git/awsmfa for local dev: AWS MFA auth status + expiry, dev compose stack control, container drift vs the dev repo, git repo status, prod-data and DB-access tools. Config-driven (~/.config/mydev/config.yaml). Dashboard runs commands via a command palette with captured/interactive modes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
755 B
Go
39 lines
755 B
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"text/tabwriter"
|
|
|
|
"mydev/internal/checks"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var dockerCmd = &cobra.Command{
|
|
Use: "docker",
|
|
Short: "List docker containers and their status",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
list, errMsg := checks.Containers(context.Background())
|
|
if errMsg != "" {
|
|
fmt.Printf("✗ docker error: %s\n", errMsg)
|
|
os.Exit(1)
|
|
}
|
|
if len(list) == 0 {
|
|
fmt.Println("no containers")
|
|
return
|
|
}
|
|
w := tabwriter.NewWriter(os.Stdout, 0, 2, 2, ' ', 0)
|
|
fmt.Fprintln(w, "NAME\tSTATE\tSTATUS\tIMAGE")
|
|
for _, c := range list {
|
|
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", c.Name, c.State, c.Status, c.Image)
|
|
}
|
|
w.Flush()
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(dockerCmd)
|
|
}
|