mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
chore: migrate to lipgloss/v2
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"charm.land/lipgloss/v2"
|
||||
composecli "github.com/compose-spec/compose-go/v2/cli"
|
||||
"github.com/docker/compose/v2/pkg/progress"
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
|
||||
@@ -3,17 +3,19 @@ package image
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/charmbracelet/lipgloss/table"
|
||||
"charm.land/lipgloss/v2"
|
||||
"charm.land/lipgloss/v2/table"
|
||||
"github.com/charmbracelet/colorprofile"
|
||||
"github.com/containerd/platforms"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/muesli/termenv"
|
||||
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
"github.com/psviderski/uncloud/pkg/api"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -222,7 +224,7 @@ func formatPlatforms(platforms []string) string {
|
||||
Foreground(lipgloss.Color("0")).
|
||||
Background(lipgloss.Color("152"))
|
||||
// Use fancy pill borders only if the output is a terminal with color support.
|
||||
if lipgloss.ColorProfile() != termenv.Ascii {
|
||||
if colorprofile.Detect(os.Stdout, os.Environ()) > colorprofile.ASCII {
|
||||
platformStyle = platformStyle.Border(lipgloss.Border{Left: "", Right: ""}, false, true, false, true)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/charmbracelet/lipgloss/tree"
|
||||
"charm.land/lipgloss/v2"
|
||||
"charm.land/lipgloss/v2/tree"
|
||||
"github.com/docker/compose/v2/pkg/progress"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"net/netip"
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"charm.land/lipgloss/v2"
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/caddy"
|
||||
cmdcontext "github.com/psviderski/uncloud/cmd/uncloud/context"
|
||||
"github.com/psviderski/uncloud/cmd/uncloud/dns"
|
||||
|
||||
+4
-3
@@ -7,8 +7,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/huh/spinner"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/charmbracelet/lipgloss/table"
|
||||
lipgloss "charm.land/lipgloss/v2"
|
||||
"charm.land/lipgloss/v2/table"
|
||||
lipglossv1 "github.com/charmbracelet/lipgloss"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -85,7 +86,7 @@ func runPs(ctx context.Context, uncli *cli.CLI, opts psOptions) error {
|
||||
err = spinner.New().
|
||||
Title(" Collecting container info...").
|
||||
Type(spinner.MiniDot).
|
||||
Style(lipgloss.NewStyle().Foreground(lipgloss.Color("3"))).
|
||||
Style(lipglossv1.NewStyle().Foreground(lipglossv1.Color("3"))).
|
||||
ActionWithErr(func(ctx context.Context) error {
|
||||
containers, err = collectContainers(ctx, clusterClient)
|
||||
return err
|
||||
|
||||
+14
-12
@@ -10,7 +10,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"image/color"
|
||||
|
||||
"charm.land/lipgloss/v2"
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
@@ -205,17 +207,17 @@ func runLogs(ctx context.Context, uncli *cli.CLI, serviceNames []string, opts lo
|
||||
}
|
||||
|
||||
// Available colors for machine/service differentiation.
|
||||
var colorPalette = []lipgloss.Color{
|
||||
lipgloss.Color("10"), // Bright green
|
||||
lipgloss.Color("11"), // Bright yellow
|
||||
lipgloss.Color("12"), // Bright blue
|
||||
lipgloss.Color("13"), // Bright magenta
|
||||
lipgloss.Color("14"), // Bright cyan
|
||||
lipgloss.Color("2"), // Green
|
||||
lipgloss.Color("3"), // Yellow
|
||||
lipgloss.Color("4"), // Blue
|
||||
lipgloss.Color("5"), // Magenta
|
||||
lipgloss.Color("6"), // Cyan
|
||||
var colorPalette = []color.Color{
|
||||
lipgloss.BrightGreen,
|
||||
lipgloss.BrightYellow,
|
||||
lipgloss.BrightBlue,
|
||||
lipgloss.BrightMagenta,
|
||||
lipgloss.BrightCyan,
|
||||
lipgloss.Green,
|
||||
lipgloss.Yellow,
|
||||
lipgloss.Blue,
|
||||
lipgloss.Magenta,
|
||||
lipgloss.Cyan,
|
||||
}
|
||||
|
||||
// logFormatter handles formatting and printing of log entries with dynamic column alignment.
|
||||
|
||||
Reference in New Issue
Block a user