Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
chore: refactor cli bytes logic
Kyle Mendell246939bd17ef
diff --git a/cli/go.mod b/cli/go.modindex ef32feb6f..a149a730c 100644--- a/cli/go.mod+++ b/cli/go.mod@@ -20,7 +20,7 @@ require (github.com/spf13/viper v1.21.0github.com/stretchr/testify v1.11.1go.getarcane.app/sys/atomic v0.1.0- go.withmatt.com/size v0.0.0-20250220224316-11aee5773e67+ go.getarcane.app/sys/bytes v0.1.0)require (@@ -54,7 +54,7 @@ require (github.com/inconshreveable/mousetrap v1.1.0 // indirectgithub.com/lucasb-eyer/go-colorful v1.4.0 // indirectgithub.com/mattn/go-colorable v0.1.15 // indirect- github.com/mattn/go-isatty v0.0.22 // indirect+ github.com/mattn/go-isatty v0.0.23 // indirectgithub.com/mattn/go-shellwords v1.0.13 // indirectgithub.com/moby/docker-image-spec v1.3.1 // indirectgithub.com/moby/moby/api v1.55.0 // indirect@@ -67,7 +67,7 @@ require (github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirectgithub.com/opencontainers/go-digest v1.0.0 // indirectgithub.com/opencontainers/image-spec v1.1.1 // indirect- github.com/pelletier/go-toml/v2 v2.3.1 // indirect+ github.com/pelletier/go-toml/v2 v2.4.3 // indirectgithub.com/pkg/errors v0.9.1 // indirectgithub.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirectgithub.com/prometheus/client_golang v1.24.1 // indirectdiff --git a/cli/go.sum b/cli/go.sumindex 322416183..80b632c4c 100644--- a/cli/go.sum+++ b/cli/go.sum@@ -99,8 +99,8 @@ github.com/lucasb-eyer/go-colorful v1.4.0 h1:UtrWVfLdarDgc44HcS7pYloGHJUjHV/4FwWgithub.com/lucasb-eyer/go-colorful v1.4.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=-github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=-github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=+github.com/mattn/go-isatty v0.0.23 h1:cYwCQTQf3HB6xUC+BtyCLZNr7IzbOmoZbmssVNzSyiQ=+github.com/mattn/go-isatty v0.0.23/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=github.com/mattn/go-runewidth v0.0.24 h1:cpokDiIn0MGnhdHwuWnJBITySJ20QyNGnY2kR/ay2DU=github.com/mattn/go-runewidth v0.0.24/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=github.com/mattn/go-shellwords v1.0.13 h1:DC0OMEpGjm6LfNFU4ckYcvbQKyp2vE8atyFGXNtDcf4=@@ -127,8 +127,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=-github.com/pelletier/go-toml/v2 v2.3.1 h1:MYEvvGnQjeNkRF1qUuGolNtNExTDwct51yp7olPtrEc=-github.com/pelletier/go-toml/v2 v2.3.1/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=+github.com/pelletier/go-toml/v2 v2.4.3 h1:GTRvJQutkOSftxIFD5xw9aepkYNuPWmVJpffdDPYVpY=+github.com/pelletier/go-toml/v2 v2.4.3/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=@@ -180,6 +180,8 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMgithub.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=go.getarcane.app/sys/atomic v0.1.0 h1:0HhUeGXYdKAmMW24O+OaqcjDZx6twAuYPBu9T91zKsk=go.getarcane.app/sys/atomic v0.1.0/go.mod h1:QPb5eUXYKYG5acp9jJBAZ/PTbHbByDAQG6eDNAsZZ2w=+go.getarcane.app/sys/bytes v0.1.0 h1:snAEkCKzzd7PQ4bAI4gYx92YjZL4ZZK43Z/8y/P5uro=+go.getarcane.app/sys/bytes v0.1.0/go.mod h1:R2mujqg+MmC2tr+97IPqaxzvBC8+ykng+5r+XNxwY+8=go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 h1:8tvICD4vSTOOsNrsI4Ljf6C+6UKvpTEH5XY3JMoyPoo=@@ -200,8 +202,6 @@ go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=-go.withmatt.com/size v0.0.0-20250220224316-11aee5773e67 h1:nHPqmzoLZv+9OqER7S2oXnIBDAbIaIKKrVtNtDvJzjc=-go.withmatt.com/size v0.0.0-20250220224316-11aee5773e67/go.mod h1:WFmSrzphcXaSV4LG3YfIw42bPHDK8A6WsAYZCxyys/c=go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=diff --git a/cli/internal/output/tui.go b/cli/internal/output/tui.goindex 69f1fa024..62665fff5 100644--- a/cli/internal/output/tui.go+++ b/cli/internal/output/tui.go@@ -8,7 +8,7 @@ import ("charm.land/bubbles/v2/progress""charm.land/bubbles/v2/spinner"tea "charm.land/bubbletea/v2"- "go.withmatt.com/size"+ "go.getarcane.app/sys/bytes")type spinnerDoneMsg struct{}@@ -149,11 +149,11 @@ func (m progressModel) View() tea.View {return tea.NewView(fmt.Sprintf("%s\n%s", m.label, bar))}-func safeCapacity(value int64) size.Capacity {+func safeCapacity(value int64) bytes.Capacity {if value < 0 {- return size.Capacity(0)+ return bytes.Capacity(0)}- return size.Capacity(uint64(value))+ return bytes.Capacity(uint64(value))}// Progress renders a Bubble Tea progress bar inline.diff --git a/cli/pkg/images/cmd.go b/cli/pkg/images/cmd.goindex 56369c0aa..e85bde990 100644--- a/cli/pkg/images/cmd.go+++ b/cli/pkg/images/cmd.go@@ -56,7 +56,7 @@ import ("github.com/getarcaneapp/arcane/cli/v2/pkg/images/updates""github.com/getarcaneapp/arcane/types/v2/image""github.com/spf13/cobra"- "go.withmatt.com/size"+ "go.getarcane.app/sys/bytes")var (@@ -174,7 +174,7 @@ var imagesListCmd = &cobra.Command{inUse = color.New(color.FgGreen).Sprint("Yes")}id := color.New(color.FgHiWhite, color.Bold).Sprint(img.ID)- rows = append(rows, []string{id, tag, size.Capacity(img.Size).String(), inUse})+ rows = append(rows, []string{id, tag, bytes.Capacity(img.Size).String(), inUse})}output.Table(headers, rows)@@ -239,7 +239,7 @@ var imagesGetCmd = &cobra.Command{if len(result.Data.RepoTags) > 0 {output.KeyValue("Tags", strings.Join(result.Data.RepoTags, ", "))}- output.KeyValue("Size", size.Capacity(result.Data.Size).String())+ output.KeyValue("Size", bytes.Capacity(result.Data.Size).String())output.KeyValue("Architecture", result.Data.Architecture)output.KeyValue("OS", result.Data.Os)if result.Data.Created != "" {@@ -537,7 +537,7 @@ var imagesPruneCmd = &cobra.Command{return errors.WrapIf(err, "failed to parse response")}- output.Success("Pruned %d images, reclaimed %s", len(result.Data.ImagesDeleted), size.Capacity(result.Data.SpaceReclaimed).String())+ output.Success("Pruned %d images, reclaimed %s", len(result.Data.ImagesDeleted), bytes.Capacity(result.Data.SpaceReclaimed).String())return nil},@@ -589,7 +589,7 @@ var imagesCountsCmd = &cobra.Command{output.KeyValue("In Use", result.Data.Inuse)output.KeyValue("Unused", result.Data.Unused)output.KeyValue("Total", result.Data.Total)- output.KeyValue("Total Size", size.Capacity(result.Data.TotalSize).String())+ output.KeyValue("Total Size", bytes.Capacity(result.Data.TotalSize).String())return nil},diff --git a/go.work.sum b/go.work.sumindex 5ea8bcbd0..71ba1dddf 100644--- a/go.work.sum+++ b/go.work.sum@@ -2112,6 +2112,8 @@ go.etcd.io/gofail v0.2.0 h1:p19drv16FKK345a09a1iubchlw/vmRuksmRzgBIGjcA=go.etcd.io/gofail v0.2.0/go.mod h1:nL3ILMGfkXTekKI3clMBNazKnjUZjYLKmBHzsVAnC1o=go.etcd.io/raft/v3 v3.6.0 h1:5NtvbDVYpnfZWcIHgGRk9DyzkBIXOi8j+DDp1IcnUWQ=go.etcd.io/raft/v3 v3.6.0/go.mod h1:nLvLevg6+xrVtHUmVaTcTz603gQPHfh7kUAwV6YpfGo=+go.getarcane.app/sys/bytes v0.1.0 h1:snAEkCKzzd7PQ4bAI4gYx92YjZL4ZZK43Z/8y/P5uro=+go.getarcane.app/sys/bytes v0.1.0/go.mod h1:R2mujqg+MmC2tr+97IPqaxzvBC8+ykng+5r+XNxwY+8=go.getarcane.app/updater v0.3.6 h1:+BqoycaRsHj+cLVSzcYQuqbHxUKbtmaozMNblz5bVSw=go.getarcane.app/updater v0.3.6/go.mod h1:2ENitZR/lA5MuBn60OZYR5wvU3ZCE+pAgfrebfOlRDA=go.getarcane.app/updater v0.3.7 h1:WqHsxudvt8gvCR7iSHdxdzwH0+hM0FAh64bSypBX9Mo=