Compare commits

...

21 Commits

Author SHA1 Message Date
devydave d8f283c7db refactor: build without make 2026-05-06 21:21:31 +02:00
devydave 6488d13e5b feat: adds nix flake 2026-05-05 21:32:42 +02:00
decentral1se 1e80d111e6 test: less flaky test 2026-05-02 09:56:40 +02:00
Weblate 7a079b78de chore: update translation files
Updated by "Update PO files to match POT (msgmerge)" add-on in Weblate.

Translation: Co-op Cloud/abra
Translate-URL: https://translate.coopcloud.tech/projects/co-op-cloud/abra/
2026-04-11 13:54:52 +00:00
iexos 7524a785ce chore: make i18n 2026-04-11 11:36:14 +02:00
iexos 1013f669bb fix: i18n & clarify no release notes msg 2026-04-10 23:22:40 +02:00
decentral1se aae20f07cc fix: general golang path [ci skip] 2026-04-03 22:59:21 +02:00
decentral1se 6ef8e1ff52 test: temporarily skip flaky test
See toolshed/abra#814
2026-04-01 11:37:07 +02:00
decentral1se 7fb9675b1e chore: golang 1.26 && make deps 2026-04-01 11:25:57 +02:00
decentral1se d88b478503 test: unit tests clean up themselves
See toolshed/abra#792
2026-04-01 10:47:32 +02:00
decentral1se 7a735043cd fix: unbork json [ci skip] 2026-03-30 09:40:13 +02:00
decentral1se e610f32c35 fix: ignore new forked deps [ci skip] 2026-03-29 18:15:47 +02:00
p4u1 e04a1e15c4 feat: add filename to error message when yaml file is invalid
Before:
FATA <internal/validate.go:84> unable to validate recipe: yaml: line 3: did not find expected key

After:
FATA <internal/validate.go:84> unable to validate recipe: <redacted>/recipes/monitoring-ng/compose.grafana-oidc.yml: yaml: line 3: did not find expected key
2026-03-20 14:42:14 +01:00
decentral1se 9d401202b4 test: ensure "release, fail, release" works
See toolshed/abra#794
2026-03-05 11:28:34 +01:00
decentral1se 6504be6403 test: ensure reproducible version 2026-03-05 11:28:33 +01:00
Weblate d4944dbf35 chore: update translation files
Updated by "Update PO files to match POT (msgmerge)" add-on in Weblate.

Translation: Co-op Cloud/abra
Translate-URL: https://translate.coopcloud.tech/projects/co-op-cloud/abra/
2026-03-03 00:03:00 +00:00
decentral1se 8d8d4f799d chore: i18n 2026-03-03 01:02:49 +01:00
iexos 0633f24d1b feat: recipe release reverts completely on failure 2026-03-03 00:02:15 +00:00
decentral1se 2e062899c7 feat: release make target 2026-03-01 09:42:59 +01:00
decentral1se fbd7275f03 build: remove broken goreleaser automagic
See toolshed/abra#780
2026-03-01 09:40:29 +01:00
ChasquiLabo cedf185e97 chore: translation using Weblate (Spanish)
Currently translated at 91.1% (1048 of 1150 strings)

Translation: Co-op Cloud/abra
Translate-URL: https://translate.coopcloud.tech/projects/co-op-cloud/abra/es/
2026-02-28 13:52:56 +00:00
685 changed files with 49045 additions and 79007 deletions
+4 -32
View File
@@ -3,7 +3,7 @@ kind: pipeline
name: coopcloud.tech/abra name: coopcloud.tech/abra
steps: steps:
- name: make check - name: make check
image: golang:1.24 image: golang:1.26
commands: commands:
- make check - make check
@@ -22,7 +22,7 @@ steps:
- tag - tag
- name: xgettext-go status - name: xgettext-go status
image: golang:1.24-alpine3.22 image: golang:1.26-alpine3.22
commands: commands:
- apk add patchutils git make - apk add patchutils git make
- cd /drone/src - cd /drone/src
@@ -38,42 +38,14 @@ steps:
- tag - tag
- name: make test - name: make test
image: golang:1.24 image: golang:1.26
environment: environment:
ABRA_DIR: $HOME/.abra ABRA_DIR: /root/.abra_test
CATL_URL: https://git.coopcloud.tech/toolshed/recipes-catalogue-json.git
commands: commands:
- mkdir -p $HOME/.abra
- git clone $CATL_URL $HOME/.abra/catalogue
- make test - make test
depends_on: depends_on:
- make check - make check
- name: fetch
image: docker:git
commands:
- git fetch --tags
depends_on:
- make check
- make test
when:
event: tag
- name: release
image: goreleaser/goreleaser:v2.5.1
environment:
GITEA_TOKEN:
from_secret: goreleaser_gitea_token
volumes:
- name: deps
path: /go
commands:
- goreleaser release
depends_on:
- fetch
when:
event: tag
- name: publish image - name: publish image
image: plugins/docker image: plugins/docker
settings: settings:
+2 -3
View File
@@ -1,5 +1,5 @@
# Build image # Build image
FROM golang:1.24-alpine AS build FROM golang:1.26-alpine AS build
ENV GOPRIVATE=coopcloud.tech ENV GOPRIVATE=coopcloud.tech
@@ -15,8 +15,7 @@ WORKDIR /app
RUN CGO_ENABLED=0 make build RUN CGO_ENABLED=0 make build
# Release image ("slim") FROM alpine:3.22
FROM alpine:3.19.1
RUN apk add --no-cache \ RUN apk add --no-cache \
ca-certificates \ ca-certificates \
+5 -2
View File
@@ -2,7 +2,7 @@ ABRA := ./cmd/abra
XGETTEXT := ./bin/xgettext-go XGETTEXT := ./bin/xgettext-go
COMMIT := $(shell git rev-list -1 HEAD) COMMIT := $(shell git rev-list -1 HEAD)
GOPATH := $(shell go env GOPATH) GOPATH := $(shell go env GOPATH)
GOVERSION := 1.24 GOVERSION := 1.26
LDFLAGS := "-X 'main.Commit=$(COMMIT)'" LDFLAGS := "-X 'main.Commit=$(COMMIT)'"
DIST_LDFLAGS := $(LDFLAGS)" -s -w" DIST_LDFLAGS := $(LDFLAGS)" -s -w"
BFLAGS := -v -trimpath BFLAGS := -v -trimpath
@@ -40,7 +40,7 @@ check:
(echo "gofmt: formatting issue - run 'make format' to resolve" && exit 1) (echo "gofmt: formatting issue - run 'make format' to resolve" && exit 1)
test: test:
@go test ./... -cover -v @go test ./... -cover -v -p 1
find-tests: find-tests:
@find . -name "*_test.go" @find . -name "*_test.go"
@@ -86,3 +86,6 @@ build-mo:
for lang in $(POFILES); do \ for lang in $(POFILES); do \
msgfmt $$lang -o $$(echo $$lang | sed 's/.po/.mo/g') --statistics; \ msgfmt $$lang -o $$(echo $$lang | sed 's/.po/.mo/g') --statistics; \
done done
release:
@goreleaser release --clean
+1 -1
View File
@@ -238,7 +238,7 @@ beforehand. See "abra app backup" for more.`),
if upgradeReleaseNotes == "" { if upgradeReleaseNotes == "" {
upgradeWarnMessages = append( upgradeWarnMessages = append(
upgradeWarnMessages, upgradeWarnMessages,
fmt.Sprintf("no release notes available for %s", chosenUpgrade), i18n.G("no release notes for upgrading from %s to %s", deployMeta.Version, chosenUpgrade),
) )
} }
+30 -52
View File
@@ -97,6 +97,16 @@ your private key and enter your passphrase beforehand.
log.Fatal(i18n.G("main app service version for %s is empty?", recipe.Name)) log.Fatal(i18n.G("main app service version for %s is empty?", recipe.Name))
} }
repo, err := git.PlainOpen(recipe.Dir)
if err != nil {
log.Fatal(err)
}
preCommitHead, err := repo.Head()
if err != nil {
log.Fatal(err)
}
isClean, err := gitPkg.IsClean(recipe.Dir) isClean, err := gitPkg.IsClean(recipe.Dir)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
@@ -201,11 +211,6 @@ likely to change.
} }
if tagString == "" { if tagString == "" {
repo, err := git.PlainOpen(recipe.Dir)
if err != nil {
log.Fatal(err)
}
var lastGitTag tagcmp.Tag var lastGitTag tagcmp.Tag
iter, err := repo.Tags() iter, err := repo.Tags()
if err != nil { if err != nil {
@@ -282,16 +287,6 @@ likely to change.
log.Fatal(i18n.G("invalid version %s specified", tagString)) log.Fatal(i18n.G("invalid version %s specified", tagString))
} }
mainService := "app"
label := i18n.G("coop-cloud.${STACK_NAME}.version=%s", tagString)
if !internal.Dry {
if err := recipe.UpdateLabel("compose.y*ml", mainService, label); err != nil {
log.Fatal(err)
}
} else {
log.Info(i18n.G("dry run: not syncing label %s for recipe %s", tagString, recipe.Name))
}
for _, tag := range tags { for _, tag := range tags {
previousTagLeftHand := strings.Split(tag, "+")[0] previousTagLeftHand := strings.Split(tag, "+")[0]
newTagStringLeftHand := strings.Split(tagString, "+")[0] newTagStringLeftHand := strings.Split(tagString, "+")[0]
@@ -300,24 +295,15 @@ likely to change.
} }
} }
repo, err := git.PlainOpen(recipe.Dir)
if err != nil {
log.Fatal(err)
}
preCommitHead, err := repo.Head()
if err != nil {
log.Fatal(err)
}
if err := createReleaseFromTag(recipe, tagString, mainAppVersion); err != nil { if err := createReleaseFromTag(recipe, tagString, mainAppVersion); err != nil {
if cleanErr := cleanTag(recipe, tagString); cleanErr != nil { if cleanErr := cleanTag(recipe, tagString); cleanErr != nil {
log.Fatal(cleanErr) log.Fatal(i18n.G("unable to clean up tag after failed release attempt: %s", cleanErr))
} }
if cleanErr := cleanCommit(recipe, preCommitHead); cleanErr != nil { if resetErr := resetCommit(recipe, preCommitHead); resetErr != nil {
log.Fatal(cleanErr) log.Fatal(i18n.G("unable to reset commit after failed release attempt: %s", resetErr))
} }
log.Fatal(err) log.Error(err)
log.Fatal(i18n.G("release failed. any changes made have been reverted"))
} }
}, },
} }
@@ -375,23 +361,14 @@ func createReleaseFromTag(recipe recipePkg.Recipe, tagString, mainAppVersion str
return err return err
} }
tag, err := tagcmp.Parse(tagString) mainService := "app"
if err != nil { label := fmt.Sprintf("coop-cloud.${STACK_NAME}.version=%s", tagString)
return err if !internal.Dry {
} if err := recipe.UpdateLabel("compose.y*ml", mainService, label); err != nil {
log.Fatal(err)
if tag.MissingMinor { }
tag.Minor = "0" } else {
tag.MissingMinor = false log.Info(i18n.G("dry run: not syncing label %s for recipe %s", tagString, recipe.Name))
}
if tag.MissingPatch {
tag.Patch = "0"
tag.MissingPatch = false
}
if tagString == "" {
tagString = fmt.Sprintf("%s+%s", tag.String(), mainAppVersion)
} }
if err := addReleaseNotes(recipe, tagString); err != nil { if err := addReleaseNotes(recipe, tagString); err != nil {
@@ -587,9 +564,10 @@ func pushRelease(recipe recipePkg.Recipe, tagString string) error {
return nil return nil
} }
// cleanCommit soft removes the latest release commit. No change are lost the // resetCommit hard resets to the state before release was started.
// the commit itself is removed. This is the equivalent of `git reset HEAD~1`. // This will only remove changes made by the release process due to requiring
func cleanCommit(recipe recipePkg.Recipe, head *plumbing.Reference) error { // a clean working directory.
func resetCommit(recipe recipePkg.Recipe, head *plumbing.Reference) error {
repo, err := git.PlainOpen(recipe.Dir) repo, err := git.PlainOpen(recipe.Dir)
if err != nil { if err != nil {
return errors.New(i18n.G("unable to open repo in %s: %s", recipe.Dir, err)) return errors.New(i18n.G("unable to open repo in %s: %s", recipe.Dir, err))
@@ -600,12 +578,12 @@ func cleanCommit(recipe recipePkg.Recipe, head *plumbing.Reference) error {
return errors.New(i18n.G("unable to open work tree in %s: %s", recipe.Dir, err)) return errors.New(i18n.G("unable to open work tree in %s: %s", recipe.Dir, err))
} }
opts := &git.ResetOptions{Commit: head.Hash(), Mode: git.MixedReset} opts := &git.ResetOptions{Commit: head.Hash(), Mode: git.HardReset}
if err := worktree.Reset(opts); err != nil { if err := worktree.Reset(opts); err != nil {
return errors.New(i18n.G("unable to soft reset %s: %s", recipe.Dir, err)) return errors.New(i18n.G("unable to hard reset %s: %s", recipe.Dir, err))
} }
log.Debug(i18n.G("removed freshly created commit")) log.Debug(i18n.G("reset commit to pre-release state"))
return nil return nil
} }
Generated
+61
View File
@@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1777954456,
"narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
+37
View File
@@ -0,0 +1,37 @@
{
description = "The Co-op Cloud utility belt";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages = rec {
abra = pkgs.callPackage ./package.nix { };
default = abra;
};
apps = rec {
abra = flake-utils.lib.mkApp { drv = self.packages.${system}.abra; };
default = abra;
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
go_1_26
gnumake
];
};
}
);
}
+51 -52
View File
@@ -1,8 +1,6 @@
module coopcloud.tech/abra module coopcloud.tech/abra
go 1.24.0 go 1.26.0
toolchain go1.24.1
require ( require (
coopcloud.tech/tagcmp v0.0.0-20250818180036-0ec1b205b5ca coopcloud.tech/tagcmp v0.0.0-20250818180036-0ec1b205b5ca
@@ -10,19 +8,19 @@ require (
github.com/AlecAivazis/survey/v2 v2.3.7 github.com/AlecAivazis/survey/v2 v2.3.7
github.com/charmbracelet/bubbletea v1.3.10 github.com/charmbracelet/bubbletea v1.3.10
github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/lipgloss v1.1.0
github.com/charmbracelet/log v0.4.2 github.com/charmbracelet/log v1.0.0
github.com/distribution/reference v0.6.0 github.com/distribution/reference v0.6.0
github.com/docker/cli v28.4.0+incompatible github.com/docker/cli v28.4.0+incompatible
github.com/docker/docker v28.5.2+incompatible github.com/docker/docker v28.5.2+incompatible
github.com/docker/go-units v0.5.0 github.com/docker/go-units v0.5.0
github.com/go-git/go-git/v5 v5.16.2 github.com/go-git/go-git/v5 v5.17.2
github.com/google/go-cmp v0.7.0 github.com/google/go-cmp v0.7.0
github.com/leonelquinteros/gotext v1.7.2 github.com/leonelquinteros/gotext v1.7.2
github.com/moby/sys/signal v0.7.1 github.com/moby/sys/signal v0.7.1
github.com/moby/term v0.5.2 github.com/moby/term v0.5.2
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/schollz/progressbar/v3 v3.18.0 github.com/schollz/progressbar/v3 v3.19.0
golang.org/x/term v0.35.0 golang.org/x/term v0.41.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.5.2 gotest.tools/v3 v3.5.2
) )
@@ -30,27 +28,28 @@ require (
require ( require (
dario.cat/mergo v1.0.2 // indirect dario.cat/mergo v1.0.2 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/BurntSushi/toml v1.5.0 // indirect github.com/BurntSushi/toml v1.6.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.3.0 // indirect github.com/ProtonMail/go-crypto v1.4.1 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charmbracelet/colorprofile v0.3.2 // indirect github.com/charmbracelet/colorprofile v0.4.3 // indirect
github.com/charmbracelet/x/ansi v0.10.2 // indirect github.com/charmbracelet/x/ansi v0.11.6 // indirect
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 // indirect github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect github.com/charmbracelet/x/term v0.2.2 // indirect
github.com/clipperhouse/uax29/v2 v2.2.0 // indirect github.com/clipperhouse/displaywidth v0.11.0 // indirect
github.com/cloudflare/circl v1.6.1 // indirect github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
github.com/cloudflare/circl v1.6.3 // indirect
github.com/containerd/errdefs v1.0.0 // indirect github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/cyphar/filepath-securejoin v0.5.0 // indirect github.com/cyphar/filepath-securejoin v0.6.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/go-connections v0.6.0 // indirect github.com/docker/go-connections v0.6.0 // indirect
@@ -61,26 +60,26 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/ghodss/yaml v1.0.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.6.2 // indirect github.com/go-git/go-billy/v5 v5.8.0 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logfmt/logfmt v0.6.1 // indirect
github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/google/uuid v1.6.0 // indirect github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v1.4.0 // indirect github.com/kevinburke/ssh_config v1.6.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect github.com/klauspost/compress v1.18.5 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect github.com/lucasb-eyer/go-colorful v1.4.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.19 // indirect github.com/mattn/go-runewidth v0.0.21 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect github.com/miekg/pkcs11 v1.1.1 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
@@ -89,7 +88,7 @@ require (
github.com/moby/sys/atomicwriter v0.1.0 // indirect github.com/moby/sys/atomicwriter v0.1.0 // indirect
github.com/moby/sys/user v0.4.0 // indirect github.com/moby/sys/user v0.4.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect github.com/moby/sys/userns v0.1.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect github.com/morikuni/aec v1.1.0 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect github.com/muesli/termenv v0.16.0 // indirect
@@ -100,40 +99,40 @@ require (
github.com/pjbgf/sha1cd v0.5.0 // indirect github.com/pjbgf/sha1cd v0.5.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.66.1 // indirect github.com/prometheus/common v0.67.5 // indirect
github.com/prometheus/procfs v0.17.0 // indirect github.com/prometheus/procfs v0.20.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect github.com/sirupsen/logrus v1.9.4 // indirect
github.com/skeema/knownhosts v1.3.1 // indirect github.com/skeema/knownhosts v1.3.2 // indirect
github.com/spf13/pflag v1.0.10 // indirect github.com/spf13/pflag v1.0.10 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect
go.opentelemetry.io/otel v1.38.0 // indirect go.opentelemetry.io/otel v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.38.0 // indirect go.opentelemetry.io/otel/metric v1.42.0 // indirect
go.opentelemetry.io/otel/sdk v1.38.0 // indirect go.opentelemetry.io/otel/sdk v1.42.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.42.0 // indirect
go.opentelemetry.io/otel/trace v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.42.0 // indirect
go.opentelemetry.io/proto/otlp v1.8.0 // indirect go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.42.0 // indirect golang.org/x/crypto v0.49.0 // indirect
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect
golang.org/x/net v0.44.0 // indirect golang.org/x/net v0.52.0 // indirect
golang.org/x/text v0.29.0 // indirect golang.org/x/text v0.35.0 // indirect
golang.org/x/time v0.13.0 // indirect golang.org/x/time v0.15.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250929231259-57b25ae835d4 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250929231259-57b25ae835d4 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/grpc v1.75.1 // indirect google.golang.org/grpc v1.80.0 // indirect
google.golang.org/protobuf v1.36.9 // indirect google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
) )
@@ -142,12 +141,12 @@ require (
github.com/containers/image v3.0.2+incompatible github.com/containers/image v3.0.2+incompatible
github.com/containers/storage v1.38.2 // indirect github.com/containers/storage v1.38.2 // indirect
github.com/decentral1se/passgen v1.0.1 github.com/decentral1se/passgen v1.0.1
github.com/docker/docker-credential-helpers v0.9.3 // indirect github.com/docker/docker-credential-helpers v0.9.5 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect github.com/fvbommel/sortorder v1.1.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/mux v1.8.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.8 github.com/hashicorp/go-retryablehttp v0.7.8
github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/patternmatcher v0.6.1 // indirect
github.com/moby/sys/sequential v0.6.0 // indirect github.com/moby/sys/sequential v0.6.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect
@@ -156,7 +155,7 @@ require (
github.com/stretchr/testify v1.11.1 github.com/stretchr/testify v1.11.1
github.com/theupdateframework/notary v0.7.0 // indirect github.com/theupdateframework/notary v0.7.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
golang.org/x/sys v0.36.0 golang.org/x/sys v0.42.0
) )
replace github.com/docker/cli v28.4.0+incompatible => git.coopcloud.tech/toolshed/docker-cli v28.5.3-0.20260202112816-30df2d0b3a00+incompatible replace github.com/docker/cli v28.4.0+incompatible => git.coopcloud.tech/toolshed/docker-cli v28.5.3-0.20260202112816-30df2d0b3a00+incompatible
+102 -99
View File
@@ -51,8 +51,8 @@ github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
@@ -81,8 +81,8 @@ github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb0
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw= github.com/ProtonMail/go-crypto v1.4.1 h1:9RfcZHqEQUvP8RzecWEUafnZVtEvrBVL9BiF67IQOfM=
github.com/ProtonMail/go-crypto v1.3.0/go.mod h1:9whxjD8Rbs29b4XWbB8irEcE8KHMqaR2e7GWU1R+/PE= github.com/ProtonMail/go-crypto v1.4.1/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo=
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
@@ -136,20 +136,20 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw= github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4= github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4=
github.com/charmbracelet/colorprofile v0.3.2 h1:9J27WdztfJQVAQKX2WOlSSRB+5gaKqqITmrvb1uTIiI= github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q=
github.com/charmbracelet/colorprofile v0.3.2/go.mod h1:mTD5XzNeWHj8oqHb+S1bssQb7vIHbepiebQ2kPKVKbI= github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q=
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY= github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30= github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
github.com/charmbracelet/log v0.4.2 h1:hYt8Qj6a8yLnvR+h7MwsJv/XvmBJXiueUcI3cIxsyig= github.com/charmbracelet/log v1.0.0 h1:HVVVMmfOorfj3BA9i8X8UL69Hoz9lI0PYwXfJvOdRc4=
github.com/charmbracelet/log v0.4.2/go.mod h1:qifHGX/tc7eluv2R6pWIpyHDDrrb/AG71Pf2ysQu5nw= github.com/charmbracelet/log v1.0.0/go.mod h1:uYgY3SmLpwJWxmlrPwXvzVYujxis1vAKRV/0VQB7yWA=
github.com/charmbracelet/x/ansi v0.10.2 h1:ith2ArZS0CJG30cIUfID1LXN7ZFXRCww6RUvAPA+Pzw= github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=
github.com/charmbracelet/x/ansi v0.10.2/go.mod h1:HbLdJjQH4UH4AqA2HpRWuWNluRE6zxJH/yteYEYCFa8= github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ=
github.com/charmbracelet/x/cellbuf v0.0.13 h1:/KBBKHuVRbq1lYx5BzEHBAFBP8VcQzJejZ/IA3iR28k= github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=
github.com/charmbracelet/x/cellbuf v0.0.13/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs= github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=
github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ= github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ=
github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw=
github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M=
github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E=
@@ -165,11 +165,13 @@ github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJ
github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs=
github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY= github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8=
github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0=
github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8=
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
@@ -297,8 +299,8 @@ github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4=
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/cyphar/filepath-securejoin v0.5.0 h1:hIAhkRBMQ8nIeuVwcAoymp7MY4oherZdAxD+m0u9zaw= github.com/cyphar/filepath-securejoin v0.6.1 h1:5CeZ1jPXEiYt3+Z6zqprSAgSWiggmpVyciv8syjIpVE=
github.com/cyphar/filepath-securejoin v0.5.0/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= github.com/cyphar/filepath-securejoin v0.6.1/go.mod h1:A8hd4EnAeyujCJRrICiOWqjS1AX0a9kM5XL+NwKoYSc=
github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ=
github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s=
github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8=
@@ -327,8 +329,8 @@ github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r
github.com/docker/docker v28.5.2+incompatible h1:DBX0Y0zAjZbSrm1uzOkdr1onVghKaftjlSWt4AFexzM= github.com/docker/docker v28.5.2+incompatible h1:DBX0Y0zAjZbSrm1uzOkdr1onVghKaftjlSWt4AFexzM=
github.com/docker/docker v28.5.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v28.5.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8= github.com/docker/docker-credential-helpers v0.9.5 h1:EFNN8DHvaiK8zVqFA2DT6BjXE0GzfLOZ38ggPTKePkY=
github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo= github.com/docker/docker-credential-helpers v0.9.5/go.mod h1:v1S+hepowrQXITkEfw6o4+BMbGot02wiKpzWhGUZK6c=
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c/go.mod h1:CADgU4DSXK5QUlFslkQu2yW2TKzFZcXq/leZfM0UH5Q= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c/go.mod h1:CADgU4DSXK5QUlFslkQu2yW2TKzFZcXq/leZfM0UH5Q=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
@@ -387,12 +389,12 @@ github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM= github.com/go-git/go-billy/v5 v5.8.0 h1:I8hjc3LbBlXTtVuFNJuwYuMiHvQJDq1AT6u4DwDzZG0=
github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU= github.com/go-git/go-billy/v5 v5.8.0/go.mod h1:RpvI/rw4Vr5QA+Z60c6d6LXH0rYJo0uD5SqfmrrheCY=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
github.com/go-git/go-git/v5 v5.16.2 h1:fT6ZIOjE5iEnkzKyxTHK1W4HGAsPhqEqiSAssSO77hM= github.com/go-git/go-git/v5 v5.17.2 h1:B+nkdlxdYrvyFK4GPXVU8w1U+YkbsgciIR7f2sZJ104=
github.com/go-git/go-git/v5 v5.16.2/go.mod h1:4Ge4alE/5gPs30F2H1esi2gPd69R0C39lolkucHBOp8= github.com/go-git/go-git/v5 v5.17.2/go.mod h1:pW/VmeqkanRFqR6AljLcs7EA7FbZaN5MQqO7oZADXpo=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@@ -401,8 +403,8 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.1 h1:4hvbpePJKnIzH1B+8OR/JPbTx37NktoI9LE2QZBBkvE=
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logfmt/logfmt v0.6.1/go.mod h1:EV2pOAQoZaT1ZXZbqDl5hrymndi4SY9ED9/z6CO0XAk=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
@@ -423,8 +425,8 @@ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-sql-driver/mysql v1.3.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.3.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
@@ -524,8 +526,8 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c=
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -573,8 +575,8 @@ github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVE
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kevinburke/ssh_config v1.4.0 h1:6xxtP5bZ2E4NF5tuQulISpTO2z8XbtH8cg1PWkxoFkQ= github.com/kevinburke/ssh_config v1.6.0 h1:J1FBfmuVosPHf5GRdltRLhPJtJpTlMdKTBjRgTaQBFY=
github.com/kevinburke/ssh_config v1.4.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M= github.com/kevinburke/ssh_config v1.6.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
@@ -582,8 +584,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
@@ -607,8 +609,8 @@ github.com/leonelquinteros/gotext v1.7.2 h1:bDPndU8nt+/kRo1m4l/1OXiiy2v7Z7dfPQ9+
github.com/leonelquinteros/gotext v1.7.2/go.mod h1:9/haCkm5P7Jay1sxKDGJ5WIg4zkz8oZKw4ekNpALob8= github.com/leonelquinteros/gotext v1.7.2/go.mod h1:9/haCkm5P7Jay1sxKDGJ5WIg4zkz8oZKw4ekNpALob8=
github.com/lib/pq v0.0.0-20150723085316-0dad96c0b94f/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v0.0.0-20150723085316-0dad96c0b94f/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo= github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo=
github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag= github.com/lucasb-eyer/go-colorful v1.4.0 h1:UtrWVfLdarDgc44HcS7pYloGHJUjHV/4FwW4TvVgFr4=
github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lucasb-eyer/go-colorful v1.4.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/magiconair/properties v1.5.3/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.5.3/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
@@ -626,8 +628,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw= github.com/mattn/go-runewidth v0.0.21 h1:jJKAZiQH+2mIinzCJIaIG9Be1+0NR+5sz/lYEEjdM8w=
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/mattn/go-runewidth v0.0.21/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
@@ -653,8 +655,8 @@ github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6U
github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ= github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ=
github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo= github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo=
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= github.com/moby/patternmatcher v0.6.1 h1:qlhtafmr6kgMIJjKJMDmMWq7WLkKIo23hsrpR3x084U=
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/patternmatcher v0.6.1/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw= github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw=
github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs= github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs=
github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
@@ -679,8 +681,9 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/morikuni/aec v1.1.0 h1:vBBl0pUnvi/Je71dsRrhMBtreIqNMYErSAbEeb8jrXQ=
github.com/morikuni/aec v1.1.0/go.mod h1:xDRgiq/iw5l+zkao76YTKzKttOp2cwPEne25HDkJnBw=
github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
@@ -779,8 +782,8 @@ github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7q
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4=
github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
@@ -791,8 +794,8 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc=
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
@@ -805,8 +808,8 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/schollz/progressbar/v3 v3.18.0 h1:uXdoHABRFmNIjUfte/Ex7WtuyVslrw2wVPQmCN62HpA= github.com/schollz/progressbar/v3 v3.19.0 h1:Ea18xuIRQXLAUidVDox3AbwfUhD0/1IvohyTutOIFoc=
github.com/schollz/progressbar/v3 v3.18.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec= github.com/schollz/progressbar/v3 v3.19.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec=
github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U=
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
@@ -821,10 +824,10 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8= github.com/skeema/knownhosts v1.3.2 h1:EDL9mgf4NzwMXCTfaxSD/o/a5fxDw/xL9nkU28JjdBg=
github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= github.com/skeema/knownhosts v1.3.2/go.mod h1:bEg3iQAuw+jyiw+484wwFJoKSLwcfd7fqRy+N0QTiow=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
@@ -912,37 +915,37 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= 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/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 h1:OyrsyzuttWTSur2qN/Lm0m2a8yqyIjUVBZcxFPuXq2o=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0/go.mod h1:C2NGBr+kAB4bk3xtMXfZ94gqFDtg/GkI7e9zqGh5Beg=
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho=
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 h1:vl9obrcoWVKp/lwl8tRE33853I8Xru9HFbw/skNeLs8= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0 h1:MdKucPl/HbzckWWEisiNqMPhRrAOQX8r4jTuGr636gk=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0/go.mod h1:GAXRxmLJcVM3u22IjTg74zWBrRCKq8BnOqUVLodpcpw= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0/go.mod h1:RolT8tWtfHcjajEH5wFIZ4Dgh5jpPdFXYV9pTAk/qjc=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 h1:THuZiwpQZuHPul65w4WcwEnkX2QIuMT+UFoOrygtoJw=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0/go.mod h1:J2pvYM5NGHofZ2/Ru6zw/TNWnEQp5crgyDeSrYpXkAw=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 h1:zWWrB1U6nqhS/k6zYB74CjRpuiitRtLLi68VcgmOEto=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0/go.mod h1:2qXPNBX1OVRC0IwOnfo1ljoid+RD0QK3443EaqVlsOU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU=
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4=
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI=
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= go.opentelemetry.io/otel/sdk v1.42.0 h1:LyC8+jqk6UJwdrI/8VydAq/hvkFKNHZVIWuslJXYsDo=
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= go.opentelemetry.io/otel/sdk v1.42.0/go.mod h1:rGHCAxd9DAph0joO4W6OPwxjNTYWghRWmkHuGbayMts=
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= go.opentelemetry.io/otel/sdk/metric v1.42.0 h1:D/1QR46Clz6ajyZ3G8SgNlTJKBdGp84q9RKCAZ3YGuA=
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/sdk/metric v1.42.0/go.mod h1:Ua6AAlDKdZ7tdvaQKfSmnFTdHx37+J4ba8MwVCYM5hc=
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= go.opentelemetry.io/otel/trace v1.42.0 h1:OUCgIPt+mzOnaUTpOQcBiM/PLQ/Op7oq6g4LenLmOYY=
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/otel/trace v1.42.0/go.mod h1:f3K9S+IFqnumBkKhRJMeaZeNk9epyhnCmQh/EysQCdc=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.opentelemetry.io/proto/otlp v1.8.0 h1:fRAZQDcAFHySxpJ1TwlA1cJ4tvcrw7nXl9xWWC8N5CE= go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g=
go.opentelemetry.io/proto/otlp v1.8.0/go.mod h1:tIeYOeNBU4cvmPqpaji1P+KbB4Oloai8wN4rWzRrFF0= go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@@ -963,8 +966,8 @@ golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWP
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -975,8 +978,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20250911091902-df9299821621 h1:2id6c1/gto0kaHYyrixvknJ8tUK/Qs5IsmBtrc+FtgU= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 h1:jiDhWWeC7jfWqR9c/uplMOqJ0sbNlNWv0UkzE0vX1MA=
golang.org/x/exp v0.0.0-20250911091902-df9299821621/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90/go.mod h1:xE1HEv6b+1SCZ5/uscMRjUBKtIxworgEcEi+/n9NQDQ=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -1040,8 +1043,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1137,13 +1140,13 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ= golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU=
golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA= golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1153,16 +1156,16 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.13.0 h1:eUlYslOIt32DgYD6utsuUeHs4d7AsEYLuIAdg7FlYgI= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
golang.org/x/time v0.13.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -1212,8 +1215,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
@@ -1258,10 +1261,10 @@ google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfG
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto/googleapis/api v0.0.0-20250929231259-57b25ae835d4 h1:8XJ4pajGwOlasW+L13MnEGA8W4115jJySQtVfS2/IBU= google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 h1:VPWxll4HlMw1Vs/qXtN7BvhZqsS9cdAittCNvVENElA=
google.golang.org/genproto/googleapis/api v0.0.0-20250929231259-57b25ae835d4/go.mod h1:NnuHhy+bxcg30o7FnVAZbXsPHUDQ9qKWAQKCD7VxFtk= google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9/go.mod h1:7QBABkRtR8z+TEnmXTqIqwJLlzrZKVfAUm7tY3yGv0M=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250929231259-57b25ae835d4 h1:i8QOKZfYg6AbGVZzUAY3LrNWCKF8O6zFisU9Wl9RER4= google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 h1:m8qni9SQFH0tJc1X0vmnpw/0t+AImlSvp30sEupozUg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250929231259-57b25ae835d4/go.mod h1:HSkG/KdJWusxU1F6CNrwNDjBMgisKxGnc5dAZfT0mjQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
@@ -1281,8 +1284,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM=
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -1296,8 +1299,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/cenkalti/backoff.v2 v2.2.1/go.mod h1:S0QdOvT2AlerfSBkp0O+dk+bbIMaNbEmVk876gPCthU= gopkg.in/cenkalti/backoff.v2 v2.2.1/go.mod h1:S0QdOvT2AlerfSBkp0O+dk+bbIMaNbEmVk876gPCthU=
+47
View File
@@ -0,0 +1,47 @@
{
buildGo126Module,
fetchgit,
lib,
installShellFiles,
}:
buildGo126Module rec {
pname = "abra";
version = "0.13.0-beta";
rev = "06a57ded025a43c80f94d4e65299add8a31830dc";
src = fetchgit {
url = "https://git.coopcloud.tech/toolshed/abra.git";
tag = version;
hash = "sha256-rgoK0TY0WLSQ39lPvVM80zW/qJF40VFBSxYDOaKXZQo=";
};
vendorHash = null;
nativeBuildInputs = [
installShellFiles
];
env.CGO_ENABLED = 0;
ldflags = [
"-s -w -X 'main.Commit=${rev}' -X 'main.Version=${version}'"
];
doCheck = false;
postInstall = ''
export ABRA_DIR="$out"
$out/bin/abra autocomplete bash >abra.bash
$out/bin/abra autocomplete fish >abra.fish
$out/bin/abra autocomplete zsh >abra.zsh
installShellCompletion abra.{bash,fish,zsh}
'';
meta = with lib; {
description = "The Co-op Cloud utility belt";
homepage = "https://docs.coopcloud.tech/abra";
changelog = "https://git.coopcloud.tech/toolshed/abra/releases/tag/${version}";
mainProgram = "abra";
license = licenses.gpl3Plus;
maintainers = "devydave";
};
}
+67 -18
View File
@@ -10,46 +10,83 @@ import (
"coopcloud.tech/abra/pkg/config" "coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/envfile" "coopcloud.tech/abra/pkg/envfile"
"coopcloud.tech/abra/pkg/recipe" "coopcloud.tech/abra/pkg/recipe"
testPkg "coopcloud.tech/abra/pkg/test" recipePkg "coopcloud.tech/abra/pkg/recipe"
"coopcloud.tech/abra/pkg/test"
"github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/filters"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
var (
expectedAppEnv = envfile.AppEnv{
"DOMAIN": test.AppName,
"RECIPE": test.RecipeName,
}
expectedApp = appPkg.App{
Name: test.AppName,
Recipe: recipePkg.Get(expectedAppEnv["RECIPE"]),
Domain: expectedAppEnv["DOMAIN"],
Env: expectedAppEnv,
Path: expectedAppFile.Path,
Server: expectedAppFile.Server,
}
expectedAppFile = appPkg.AppFile{
Path: test.AppEnvPath,
Server: test.ServerName,
}
expectedAppFiles = map[string]appPkg.AppFile{
test.AppName: expectedAppFile,
}
)
func TestNewApp(t *testing.T) { func TestNewApp(t *testing.T) {
app, err := appPkg.NewApp(testPkg.ExpectedAppEnv, testPkg.AppName, testPkg.ExpectedAppFile) app, err := appPkg.NewApp(expectedAppEnv, test.AppName, expectedAppFile)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if !reflect.DeepEqual(app, testPkg.ExpectedApp) {
t.Fatalf("did not get expected app type. Expected: %s; Got: %s", app, testPkg.ExpectedApp) if !reflect.DeepEqual(app, expectedApp) {
t.Fatalf("did not get expected app type. Expected: %s; Got: %s", app, expectedApp)
} }
} }
func TestReadAppEnvFile(t *testing.T) { func TestReadAppEnvFile(t *testing.T) {
app, err := appPkg.ReadAppEnvFile(testPkg.ExpectedAppFile, testPkg.AppName) test.Setup()
t.Cleanup(func() { test.Teardown() })
app, err := appPkg.ReadAppEnvFile(expectedAppFile, test.AppName)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if !reflect.DeepEqual(app, testPkg.ExpectedApp) {
t.Fatalf("did not get expected app type. Expected: %s; Got: %s", app, testPkg.ExpectedApp) if !reflect.DeepEqual(app, expectedApp) {
t.Fatalf("did not get expected app type. Expected: %s; Got: %s", app, expectedApp)
} }
} }
func TestGetApp(t *testing.T) { func TestGetApp(t *testing.T) {
app, err := appPkg.GetApp(testPkg.ExpectedAppFiles, testPkg.AppName) test.Setup()
t.Cleanup(func() { test.Teardown() })
app, err := appPkg.GetApp(expectedAppFiles, test.AppName)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if !reflect.DeepEqual(app, testPkg.ExpectedApp) {
t.Fatalf("did not get expected app type. Expected: %s; Got: %s", app, testPkg.ExpectedApp) if !reflect.DeepEqual(app, expectedApp) {
t.Fatalf("did not get expected app type. Expected: %s; Got: %s", app, expectedApp)
} }
} }
func TestGetComposeFiles(t *testing.T) { func TestGetComposeFiles(t *testing.T) {
r := recipe.Get("abra-test-recipe") test.Setup()
err := r.EnsureExists() t.Cleanup(func() { test.Teardown() })
if err != nil {
r := recipe.Get(test.AbraTestRecipe)
if err := r.EnsureExists(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -94,7 +131,10 @@ func TestGetComposeFiles(t *testing.T) {
} }
func TestGetComposeFilesError(t *testing.T) { func TestGetComposeFilesError(t *testing.T) {
r := recipe.Get("abra-test-recipe") test.Setup()
t.Cleanup(func() { test.Teardown() })
r := recipe.Get(test.AbraTestRecipe)
err := r.EnsureExists() err := r.EnsureExists()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@@ -186,26 +226,32 @@ func TestFilters(t *testing.T) {
func compareFilter(t *testing.T, f1 filters.Args, f2 map[string]map[string]bool) { func compareFilter(t *testing.T, f1 filters.Args, f2 map[string]map[string]bool) {
t.Helper() t.Helper()
j1, err := f1.MarshalJSON() j1, err := f1.MarshalJSON()
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
j2, err := json.Marshal(f2) j2, err := json.Marshal(f2)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
if diff := cmp.Diff(string(j2), string(j1)); diff != "" { if diff := cmp.Diff(string(j2), string(j1)); diff != "" {
t.Errorf("filters mismatch (-want +got):\n%s", diff) t.Errorf("filters mismatch (-want +got):\n%s", diff)
} }
} }
func TestWriteRecipeVersionOverwrite(t *testing.T) { func TestWriteRecipeVersionOverwrite(t *testing.T) {
app, err := appPkg.GetApp(testPkg.ExpectedAppFiles, testPkg.AppName) test.Setup()
t.Cleanup(func() { test.Teardown() })
app, err := appPkg.GetApp(expectedAppFiles, test.AppName)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer t.Cleanup(func() { t.Cleanup(func() {
if err := app.WipeRecipeVersion(); err != nil { if err := app.WipeRecipeVersion(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -217,7 +263,7 @@ func TestWriteRecipeVersionOverwrite(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
app, err = appPkg.GetApp(testPkg.ExpectedAppFiles, testPkg.AppName) app, err = appPkg.GetApp(expectedAppFiles, test.AppName)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -226,7 +272,10 @@ func TestWriteRecipeVersionOverwrite(t *testing.T) {
} }
func TestWriteRecipeVersionUnknown(t *testing.T) { func TestWriteRecipeVersionUnknown(t *testing.T) {
app, err := appPkg.GetApp(testPkg.ExpectedAppFiles, testPkg.AppName) test.Setup()
t.Cleanup(func() { test.Teardown() })
app, err := appPkg.GetApp(expectedAppFiles, test.AppName)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
+4 -3
View File
@@ -4,6 +4,7 @@ import (
"testing" "testing"
appPkg "coopcloud.tech/abra/pkg/app" appPkg "coopcloud.tech/abra/pkg/app"
"coopcloud.tech/abra/pkg/test"
testPkg "coopcloud.tech/abra/pkg/test" testPkg "coopcloud.tech/abra/pkg/test"
stack "coopcloud.tech/abra/pkg/upstream/stack" stack "coopcloud.tech/abra/pkg/upstream/stack"
@@ -11,8 +12,8 @@ import (
) )
func TestGetTimeoutFromLabel(t *testing.T) { func TestGetTimeoutFromLabel(t *testing.T) {
testPkg.MkServerAppRecipe() test.Setup()
defer testPkg.RmServerAppRecipe() t.Cleanup(func() { test.Teardown() })
tests := []struct { tests := []struct {
configuredTimeout string configuredTimeout string
@@ -25,7 +26,7 @@ func TestGetTimeoutFromLabel(t *testing.T) {
} }
for _, test := range tests { for _, test := range tests {
app, err := appPkg.GetApp(testPkg.ExpectedAppFiles, testPkg.AppName) app, err := appPkg.GetApp(expectedAppFiles, testPkg.AppName)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
+9 -6
View File
@@ -10,8 +10,9 @@ import (
func TestFindAbraConfig(t *testing.T) { func TestFindAbraConfig(t *testing.T) {
wd, err := os.Getwd() wd, err := os.Getwd()
if err != nil { if err != nil {
log.Fatal(err) t.Fatal(err)
} }
tests := []struct { tests := []struct {
Dir string Dir string
Config string Config string
@@ -51,8 +52,9 @@ func TestFindAbraConfig(t *testing.T) {
func TestLoadAbraConfigGetAbraDir(t *testing.T) { func TestLoadAbraConfigGetAbraDir(t *testing.T) {
wd, err := os.Getwd() wd, err := os.Getwd()
if err != nil { if err != nil {
log.Fatal(err) t.Fatal(err)
} }
t.Setenv("ABRA_DIR", "") t.Setenv("ABRA_DIR", "")
t.Run("default", func(t *testing.T) { t.Run("default", func(t *testing.T) {
@@ -67,7 +69,7 @@ func TestLoadAbraConfigGetAbraDir(t *testing.T) {
t.Cleanup(func() { os.Chdir(wd) }) t.Cleanup(func() { os.Chdir(wd) })
err = os.Chdir(filepath.Join(wd, "testdata/abraconfig1")) err = os.Chdir(filepath.Join(wd, "testdata/abraconfig1"))
if err != nil { if err != nil {
log.Fatal(err) t.Fatal(err)
} }
cfg := LoadAbraConfig() cfg := LoadAbraConfig()
@@ -81,7 +83,7 @@ func TestLoadAbraConfigGetAbraDir(t *testing.T) {
t.Cleanup(func() { os.Chdir(wd) }) t.Cleanup(func() { os.Chdir(wd) })
err := os.Chdir(filepath.Join(wd, "testdata/abraconfig2")) err := os.Chdir(filepath.Join(wd, "testdata/abraconfig2"))
if err != nil { if err != nil {
log.Fatal(err) t.Fatal(err)
} }
cfg := LoadAbraConfig() cfg := LoadAbraConfig()
@@ -104,8 +106,9 @@ func TestLoadAbraConfigGetAbraDir(t *testing.T) {
func TestLoadAbraConfigServersDir(t *testing.T) { func TestLoadAbraConfigServersDir(t *testing.T) {
wd, err := os.Getwd() wd, err := os.Getwd()
if err != nil { if err != nil {
log.Fatal(err) t.Fatal(err)
} }
t.Setenv("ABRA_DIR", "") t.Setenv("ABRA_DIR", "")
t.Run("default", func(t *testing.T) { t.Run("default", func(t *testing.T) {
@@ -120,7 +123,7 @@ func TestLoadAbraConfigServersDir(t *testing.T) {
t.Cleanup(func() { os.Chdir(wd) }) t.Cleanup(func() { os.Chdir(wd) })
err = os.Chdir(filepath.Join(wd, "testdata/abraconfig1")) err = os.Chdir(filepath.Join(wd, "testdata/abraconfig1"))
if err != nil { if err != nil {
log.Fatal(err) t.Fatal(err)
} }
cfg := LoadAbraConfig() cfg := LoadAbraConfig()
+67 -29
View File
@@ -10,48 +10,73 @@ import (
"coopcloud.tech/abra/pkg/config" "coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/envfile" "coopcloud.tech/abra/pkg/envfile"
"coopcloud.tech/abra/pkg/recipe" "coopcloud.tech/abra/pkg/recipe"
testPkg "coopcloud.tech/abra/pkg/test" "coopcloud.tech/abra/pkg/test"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
var (
expectedAppEnv = envfile.AppEnv{
"DOMAIN": test.AppName,
"RECIPE": test.RecipeName,
}
expectedAppFile = appPkg.AppFile{
Path: test.AppEnvPath,
Server: test.ServerName,
}
expectedAppFiles = map[string]appPkg.AppFile{
test.AppName: expectedAppFile,
}
)
func TestGetAllFoldersInDirectory(t *testing.T) { func TestGetAllFoldersInDirectory(t *testing.T) {
folders, err := config.GetAllFoldersInDirectory(testPkg.TestDir) folders, err := config.GetAllFoldersInDirectory(test.TestDir)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if !reflect.DeepEqual(folders, testPkg.TFolders) {
t.Fatalf("did not get expected folders. Expected: (%s), Got: (%s)", strings.Join(testPkg.TFolders, ","), strings.Join(folders, ",")) if !reflect.DeepEqual(folders, test.TFolders) {
t.Fatalf("did not get expected folders. Expected: (%s), Got: (%s)", strings.Join(test.TFolders, ","), strings.Join(folders, ","))
} }
} }
func TestGetAllFilesInDirectory(t *testing.T) { func TestGetAllFilesInDirectory(t *testing.T) {
files, err := config.GetAllFilesInDirectory(testPkg.TestDir) files, err := config.GetAllFilesInDirectory(test.TestDir)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
var fileNames []string var fileNames []string
for _, file := range files { for _, file := range files {
fileNames = append(fileNames, file.Name()) fileNames = append(fileNames, file.Name())
} }
if !reflect.DeepEqual(fileNames, testPkg.TFiles) {
t.Fatalf("did not get expected files. Expected: (%s), Got: (%s)", strings.Join(testPkg.TFiles, ","), strings.Join(fileNames, ",")) if !reflect.DeepEqual(fileNames, test.TFiles) {
t.Fatalf("did not get expected files. Expected: (%s), Got: (%s)", strings.Join(test.TFiles, ","), strings.Join(fileNames, ","))
} }
} }
func TestReadEnv(t *testing.T) { func TestReadEnv(t *testing.T) {
env, err := envfile.ReadEnv(testPkg.ExpectedAppFile.Path) test.Setup()
t.Cleanup(func() { test.Teardown() })
env, err := envfile.ReadEnv(expectedAppFile.Path)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if !reflect.DeepEqual(env, testPkg.ExpectedAppEnv) {
if !reflect.DeepEqual(env, expectedAppEnv) {
t.Fatal("did not get expected application settings") t.Fatal("did not get expected application settings")
} }
} }
func TestReadAbraShEnvVars(t *testing.T) { func TestReadAbraShEnvVars(t *testing.T) {
r := recipe.Get("abra-test-recipe") test.Setup()
err := r.EnsureExists() t.Cleanup(func() { test.Teardown() })
if err != nil {
r := recipe.Get(test.AbraTestRecipe)
if err := r.EnsureExists(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -78,9 +103,11 @@ func TestReadAbraShEnvVars(t *testing.T) {
} }
func TestReadAbraShCmdNames(t *testing.T) { func TestReadAbraShCmdNames(t *testing.T) {
r := recipe.Get("abra-test-recipe") test.Setup()
err := r.EnsureExists() t.Cleanup(func() { test.Teardown() })
if err != nil {
r := recipe.Get(test.AbraTestRecipe)
if err := r.EnsureExists(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -102,9 +129,11 @@ func TestReadAbraShCmdNames(t *testing.T) {
} }
func TestCheckEnv(t *testing.T) { func TestCheckEnv(t *testing.T) {
r := recipe.Get("abra-test-recipe") test.Setup()
err := r.EnsureExists() t.Cleanup(func() { test.Teardown() })
if err != nil {
r := recipe.Get(test.AbraTestRecipe)
if err := r.EnsureExists(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -135,9 +164,11 @@ func TestCheckEnv(t *testing.T) {
} }
func TestCheckEnvError(t *testing.T) { func TestCheckEnvError(t *testing.T) {
r := recipe.Get("abra-test-recipe") test.Setup()
err := r.EnsureExists() t.Cleanup(func() { test.Teardown() })
if err != nil {
r := recipe.Get(test.AbraTestRecipe)
if err := r.EnsureExists(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -170,9 +201,11 @@ func TestCheckEnvError(t *testing.T) {
} }
func TestEnvVarCommentsRemoved(t *testing.T) { func TestEnvVarCommentsRemoved(t *testing.T) {
r := recipe.Get("abra-test-recipe") test.Setup()
err := r.EnsureExists() t.Cleanup(func() { test.Teardown() })
if err != nil {
r := recipe.Get(test.AbraTestRecipe)
if err := r.EnsureExists(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -201,9 +234,11 @@ func TestEnvVarCommentsRemoved(t *testing.T) {
} }
func TestEnvVarModifiersIncluded(t *testing.T) { func TestEnvVarModifiersIncluded(t *testing.T) {
r := recipe.Get("abra-test-recipe") test.Setup()
err := r.EnsureExists() t.Cleanup(func() { test.Teardown() })
if err != nil {
r := recipe.Get(test.AbraTestRecipe)
if err := r.EnsureExists(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -225,7 +260,10 @@ func TestEnvVarModifiersIncluded(t *testing.T) {
} }
func TestNoOverwriteNonVersionEnvVars(t *testing.T) { func TestNoOverwriteNonVersionEnvVars(t *testing.T) {
app, err := appPkg.GetApp(testPkg.ExpectedAppFiles, testPkg.AppName) test.Setup()
t.Cleanup(func() { test.Teardown() })
app, err := appPkg.GetApp(expectedAppFiles, test.AppName)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -234,7 +272,7 @@ func TestNoOverwriteNonVersionEnvVars(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
app, err = appPkg.GetApp(testPkg.ExpectedAppFiles, testPkg.AppName) app, err = appPkg.GetApp(expectedAppFiles, test.AppName)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
+39 -1
View File
@@ -8,11 +8,44 @@ import (
"testing" "testing"
"coopcloud.tech/abra/pkg/config" "coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/log"
) )
func setup() {
teardown()
if err := os.Mkdir(os.ExpandEnv("$ABRA_DIR"), 0764); err != nil {
if !os.IsExist(err) {
log.Fatal(err)
}
}
if err := os.Mkdir(os.ExpandEnv("$ABRA_DIR/recipes"), 0764); err != nil {
if !os.IsExist(err) {
log.Fatal(err)
}
}
}
func teardown() {
abraDir := os.ExpandEnv("$ABRA_DIR")
if abraDir == fmt.Sprintf("%s/.abra", os.ExpandEnv("$HOME")) {
log.Fatal("set $ABRA_DIR before running the test suite")
}
if err := os.RemoveAll(abraDir); err != nil {
log.Fatal(err)
}
}
func TestClone(t *testing.T) { func TestClone(t *testing.T) {
setup()
t.Cleanup(func() { teardown() })
dir := path.Join(config.RECIPES_DIR, "gitea") dir := path.Join(config.RECIPES_DIR, "gitea")
os.RemoveAll(dir) if err := os.RemoveAll(dir); err != nil {
t.Fatal(err)
}
gitURL := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, "gitea") gitURL := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, "gitea")
if err := Clone(dir, gitURL); err != nil { if err := Clone(dir, gitURL); err != nil {
@@ -25,6 +58,11 @@ func TestClone(t *testing.T) {
} }
func TestCancelGitClone(t *testing.T) { func TestCancelGitClone(t *testing.T) {
t.Skip("https://git.coopcloud.tech/toolshed/abra/issues/814")
setup()
t.Cleanup(func() { teardown() })
dir := path.Join(config.RECIPES_DIR, "gitea") dir := path.Join(config.RECIPES_DIR, "gitea")
os.RemoveAll(dir) os.RemoveAll(dir)
+76 -57
View File
@@ -7,7 +7,7 @@
msgid "" msgid ""
msgstr "Project-Id-Version: \n" msgstr "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n" "Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2026-02-20 14:48+0100\n" "POT-Creation-Date: 2026-04-11 11:34+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -449,7 +449,7 @@ msgstr ""
msgid "%s was successfully moved from %s to %s 🎉" msgid "%s was successfully moved from %s to %s 🎉"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:299 #: ./cli/recipe/release.go:294
#, c-format #, c-format
msgid "%s+... conflicts with a previous release: %s" msgid "%s+... conflicts with a previous release: %s"
msgstr "" msgstr ""
@@ -1109,7 +1109,7 @@ msgstr ""
msgid "ON SERVER" msgid "ON SERVER"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:176 #: ./cli/recipe/release.go:186
msgid "PROPOSED CHANGES" msgid "PROPOSED CHANGES"
msgstr "" msgstr ""
@@ -1273,7 +1273,7 @@ msgstr ""
msgid "SERVER" msgid "SERVER"
msgstr "" msgstr ""
#: ./cli/app/ps.go:185 ./cli/recipe/release.go:176 ./cli/recipe/version.go:69 ./cli/recipe/version.go:110 #: ./cli/app/ps.go:185 ./cli/recipe/release.go:186 ./cli/recipe/version.go:69 ./cli/recipe/version.go:110
msgid "SERVICE" msgid "SERVICE"
msgstr "" msgstr ""
@@ -1594,7 +1594,7 @@ msgstr ""
msgid "[hijack] end of stdout" msgid "[hijack] end of stdout"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:128 #: ./cli/recipe/release.go:138
#, c-format #, c-format
msgid "\n" msgid "\n"
"The following options are two types of initial semantic version that you can\n" "The following options are two types of initial semantic version that you can\n"
@@ -1747,7 +1747,7 @@ msgstr ""
msgid "add [[server] | --local] [flags]" msgid "add [[server] | --local] [flags]"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:495 #: ./cli/recipe/release.go:472
msgid "add release note? (leave empty to skip)" msgid "add release note? (leave empty to skip)"
msgstr "" msgstr ""
@@ -1807,7 +1807,7 @@ msgstr ""
msgid "app domain %s (%s) does not appear to resolve to app server %s (%s)?" msgid "app domain %s (%s) does not appear to resolve to app server %s (%s)?"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:363 #: ./cli/recipe/release.go:349
msgid "app service is missing image tag?" msgid "app service is missing image tag?"
msgstr "" msgstr ""
@@ -1982,7 +1982,7 @@ msgstr ""
msgid "cannot resolve ipv4 for %s?" msgid "cannot resolve ipv4 for %s?"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:120 #: ./cli/recipe/release.go:130
msgid "cannot specify tag and bump type at the same time" msgid "cannot specify tag and bump type at the same time"
msgstr "" msgstr ""
@@ -2084,7 +2084,7 @@ msgstr ""
msgid "choosing %s as latest version of %s" msgid "choosing %s as latest version of %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:277 #: ./cli/recipe/release.go:282
#, c-format #, c-format
msgid "choosing %s as new version for %s" msgid "choosing %s as new version for %s"
msgstr "" msgstr ""
@@ -2099,7 +2099,7 @@ msgstr ""
msgid "choosing %s as version to upgrade" msgid "choosing %s as version to upgrade"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:427 #: ./cli/recipe/release.go:404
#, c-format #, c-format
msgid "chore: publish %s release" msgid "chore: publish %s release"
msgstr "" msgstr ""
@@ -2258,7 +2258,7 @@ msgstr ""
msgid "context lacks Docker endpoint" msgid "context lacks Docker endpoint"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:286 ./pkg/recipe/compose.go:229 #: ./pkg/recipe/compose.go:229
#, c-format #, c-format
msgid "coop-cloud.${STACK_NAME}.version=%s" msgid "coop-cloud.${STACK_NAME}.version=%s"
msgstr "" msgstr ""
@@ -2322,7 +2322,7 @@ msgstr ""
msgid "created secret on %s: %s" msgid "created secret on %s: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:565 #: ./cli/recipe/release.go:542
#, c-format #, c-format
msgid "created tag %s at %s" msgid "created tag %s at %s"
msgstr "" msgstr ""
@@ -2570,7 +2570,7 @@ msgstr ""
msgid "dry run: adding %s" msgid "dry run: adding %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:455 #: ./cli/recipe/release.go:432
#, c-format #, c-format
msgid "dry run: move release note from 'next' to %s" msgid "dry run: move release note from 'next' to %s"
msgstr "" msgstr ""
@@ -2579,11 +2579,11 @@ msgstr ""
msgid "dry run: no changes commited" msgid "dry run: no changes commited"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:520 #: ./cli/recipe/release.go:497
msgid "dry run: no changes committed" msgid "dry run: no changes committed"
msgstr "" msgstr ""
#: ./cli/catalogue/catalogue.go:271 ./cli/recipe/release.go:572 #: ./cli/catalogue/catalogue.go:271 ./cli/recipe/release.go:549
msgid "dry run: no changes published" msgid "dry run: no changes published"
msgstr "" msgstr ""
@@ -2592,12 +2592,12 @@ msgstr ""
msgid "dry run: no git changes pushed in %s" msgid "dry run: no git changes pushed in %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:545 #: ./cli/recipe/release.go:522
#, c-format #, c-format
msgid "dry run: no git tag created (%s)" msgid "dry run: no git tag created (%s)"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:292 #: ./cli/recipe/release.go:371
#, c-format #, c-format
msgid "dry run: not syncing label %s for recipe %s" msgid "dry run: not syncing label %s for recipe %s"
msgstr "" msgstr ""
@@ -2607,7 +2607,7 @@ msgstr ""
msgid "dry run: remote %s (%s) not created" msgid "dry run: remote %s (%s) not created"
msgstr "" msgstr ""
#: ./cli/app/move.go:349 ./cli/catalogue/catalogue.go:301 ./cli/recipe/release.go:645 #: ./cli/app/move.go:349 ./cli/catalogue/catalogue.go:301 ./cli/recipe/release.go:623
msgid "dry-run" msgid "dry-run"
msgstr "" msgstr ""
@@ -2741,7 +2741,7 @@ msgstr ""
msgid "f" msgid "f"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:398 #: ./cli/recipe/release.go:375
#, c-format #, c-format
msgid "failed to add release notes: %s" msgid "failed to add release notes: %s"
msgstr "" msgstr ""
@@ -2761,7 +2761,7 @@ msgstr ""
msgid "failed to check out %s in %s: %s" msgid "failed to check out %s in %s: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:402 #: ./cli/recipe/release.go:379
#, c-format #, c-format
msgid "failed to commit changes: %s" msgid "failed to commit changes: %s"
msgstr "" msgstr ""
@@ -2849,7 +2849,7 @@ msgstr ""
msgid "failed to parse image for %s in %s: %s" msgid "failed to parse image for %s in %s: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:410 #: ./cli/recipe/release.go:387
#, c-format #, c-format
msgid "failed to publish new release: %s" msgid "failed to publish new release: %s"
msgstr "" msgstr ""
@@ -2918,7 +2918,7 @@ msgstr ""
msgid "failed to store secret on %s: %s" msgid "failed to store secret on %s: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:406 #: ./cli/recipe/release.go:383
#, c-format #, c-format
msgid "failed to tag release: %s" msgid "failed to tag release: %s"
msgstr "" msgstr ""
@@ -3291,15 +3291,15 @@ msgstr ""
msgid "including VOLUMES=%v in backupbot exec invocation" msgid "including VOLUMES=%v in backupbot exec invocation"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:656 ./cli/recipe/upgrade.go:378 #: ./cli/recipe/release.go:634 ./cli/recipe/upgrade.go:378
msgid "increase the major part of the version" msgid "increase the major part of the version"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:664 ./cli/recipe/upgrade.go:386 #: ./cli/recipe/release.go:642 ./cli/recipe/upgrade.go:386
msgid "increase the minor part of the version" msgid "increase the minor part of the version"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:672 ./cli/recipe/upgrade.go:394 #: ./cli/recipe/release.go:650 ./cli/recipe/upgrade.go:394
msgid "increase the patch part of the version" msgid "increase the patch part of the version"
msgstr "" msgstr ""
@@ -3391,7 +3391,7 @@ msgstr ""
msgid "invalid tmpfs source, source must be empty" msgid "invalid tmpfs source, source must be empty"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:282 #: ./cli/recipe/release.go:287
#, c-format #, c-format
msgid "invalid version %s specified" msgid "invalid version %s specified"
msgstr "" msgstr ""
@@ -3547,7 +3547,7 @@ msgstr ""
msgid "main app service version for %s is empty?" msgid "main app service version for %s is empty?"
msgstr "" msgstr ""
#: ./cli/internal/recipe.go:48 ./cli/internal/recipe.go:66 ./cli/internal/recipe.go:80 ./cli/recipe/release.go:653 ./cli/recipe/upgrade.go:375 #: ./cli/internal/recipe.go:48 ./cli/internal/recipe.go:66 ./cli/internal/recipe.go:80 ./cli/recipe/release.go:631 ./cli/recipe/upgrade.go:375
msgid "major" msgid "major"
msgstr "" msgstr ""
@@ -3576,7 +3576,7 @@ msgstr ""
msgid "migrating app config from %s to %s" msgid "migrating app config from %s to %s"
msgstr "" msgstr ""
#: ./cli/internal/recipe.go:48 ./cli/internal/recipe.go:68 ./cli/internal/recipe.go:82 ./cli/recipe/release.go:661 ./cli/recipe/upgrade.go:383 #: ./cli/internal/recipe.go:48 ./cli/internal/recipe.go:68 ./cli/internal/recipe.go:82 ./cli/recipe/release.go:639 ./cli/recipe/upgrade.go:383
msgid "minor" msgid "minor"
msgstr "" msgstr ""
@@ -3675,7 +3675,7 @@ msgstr ""
msgid "new recipe '%s' created: %s" msgid "new recipe '%s' created: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:585 #: ./cli/recipe/release.go:562
#, c-format #, c-format
msgid "new release published: %s" msgid "new release published: %s"
msgstr "" msgstr ""
@@ -3726,7 +3726,7 @@ msgstr ""
msgid "no backupbot discovered, is it deployed?" msgid "no backupbot discovered, is it deployed?"
msgstr "" msgstr ""
#: ./cli/catalogue/catalogue.go:231 ./cli/recipe/release.go:531 #: ./cli/catalogue/catalogue.go:231 ./cli/recipe/release.go:508
#, c-format #, c-format
msgid "no changes discovered in %s, nothing to publish?" msgid "no changes discovered in %s, nothing to publish?"
msgstr "" msgstr ""
@@ -3760,7 +3760,7 @@ msgstr ""
msgid "no existing label found, automagic insertion not supported yet" msgid "no existing label found, automagic insertion not supported yet"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:124 #: ./cli/recipe/release.go:134
#, c-format #, c-format
msgid "no git tags found for %s" msgid "no git tags found for %s"
msgstr "" msgstr ""
@@ -3779,6 +3779,11 @@ msgstr ""
msgid "no recipe name provided" msgid "no recipe name provided"
msgstr "" msgstr ""
#: ./cli/app/upgrade.go:241
#, c-format
msgid "no release notes for upgrading from %s to %s"
msgstr ""
#: ./cli/app/secret.go:234 #: ./cli/app/secret.go:234
#, c-format #, c-format
msgid "no secret %s available for recipe %s?" msgid "no secret %s available for recipe %s?"
@@ -3994,7 +3999,7 @@ msgstr ""
msgid "pass command not found on $PATH, is it installed?" msgid "pass command not found on $PATH, is it installed?"
msgstr "" msgstr ""
#: ./cli/internal/recipe.go:48 ./cli/internal/recipe.go:70 ./cli/internal/recipe.go:84 ./cli/recipe/release.go:669 ./cli/recipe/upgrade.go:391 #: ./cli/internal/recipe.go:48 ./cli/internal/recipe.go:70 ./cli/internal/recipe.go:84 ./cli/recipe/release.go:647 ./cli/recipe/upgrade.go:391
msgid "patch" msgid "patch"
msgstr "" msgstr ""
@@ -4114,7 +4119,7 @@ msgstr ""
#. with no spaces in between #. with no spaces in between
#. translators: `abra recipe` aliases. use a comma separated list of aliases #. translators: `abra recipe` aliases. use a comma separated list of aliases
#. with no spaces in between #. with no spaces in between
#: ./cli/app/backup.go:327 ./cli/app/list.go:304 ./cli/app/move.go:350 ./cli/app/run.go:23 ./cli/app/upgrade.go:486 ./cli/catalogue/catalogue.go:302 ./cli/recipe/recipe.go:12 ./cli/recipe/release.go:646 #: ./cli/app/backup.go:327 ./cli/app/list.go:304 ./cli/app/move.go:350 ./cli/app/run.go:23 ./cli/app/upgrade.go:486 ./cli/catalogue/catalogue.go:302 ./cli/recipe/recipe.go:12 ./cli/recipe/release.go:624
msgid "r" msgid "r"
msgstr "" msgstr ""
@@ -4230,6 +4235,10 @@ msgstr ""
msgid "release <recipe> [version] [flags]" msgid "release <recipe> [version] [flags]"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:306
msgid "release failed. any changes made have been reverted"
msgstr ""
#: ./cli/app/upgrade.go:485 #: ./cli/app/upgrade.go:485
msgid "releasenotes" msgid "releasenotes"
msgstr "" msgstr ""
@@ -4290,11 +4299,7 @@ msgstr ""
msgid "removed dirty suffix from .env version: %s -> %s" msgid "removed dirty suffix from .env version: %s -> %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:608 #: ./cli/recipe/release.go:604
msgid "removed freshly created commit"
msgstr ""
#: ./cli/recipe/release.go:626
#, c-format #, c-format
msgid "removed freshly created tag %s" msgid "removed freshly created tag %s"
msgstr "" msgstr ""
@@ -4366,7 +4371,7 @@ msgstr ""
msgid "repo set config: %s" msgid "repo set config: %s"
msgstr "" msgstr ""
#: ./cli/app/move.go:352 ./cli/catalogue/catalogue.go:304 ./cli/recipe/release.go:648 #: ./cli/app/move.go:352 ./cli/catalogue/catalogue.go:304 ./cli/recipe/release.go:626
msgid "report changes that would be made" msgid "report changes that would be made"
msgstr "" msgstr ""
@@ -4387,6 +4392,10 @@ msgstr ""
msgid "reset <recipe> [flags]" msgid "reset <recipe> [flags]"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:586
msgid "reset commit to pre-release state"
msgstr ""
#: ./cli/recipe/lint.go:45 #: ./cli/recipe/lint.go:45
msgid "resolve" msgid "resolve"
msgstr "" msgstr ""
@@ -4931,7 +4940,7 @@ msgstr ""
msgid "ssh url: %s, " msgid "ssh url: %s, "
msgstr "" msgstr ""
#: ./cli/recipe/release.go:577 #: ./cli/recipe/release.go:554
msgid "ssh-agent not found. see \"abra recipe release --help\" and try again" msgid "ssh-agent not found. see \"abra recipe release --help\" and try again"
msgstr "" msgstr ""
@@ -5011,7 +5020,7 @@ msgstr ""
msgid "tag all images with stable tags" msgid "tag all images with stable tags"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:218 #: ./cli/recipe/release.go:223
#, c-format #, c-format
msgid "tag at commit %s is unannotated or otherwise broken" msgid "tag at commit %s is unannotated or otherwise broken"
msgstr "" msgstr ""
@@ -5144,6 +5153,11 @@ msgstr ""
msgid "unable to clean up git clone of %s: %s" msgid "unable to clean up git clone of %s: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:300
#, c-format
msgid "unable to clean up tag after failed release attempt: %s"
msgstr ""
#: ./cli/app/list.go:152 #: ./cli/app/list.go:152
#, c-format #, c-format
msgid "unable to clone %s: %s" msgid "unable to clone %s: %s"
@@ -5154,7 +5168,7 @@ msgstr ""
msgid "unable to connect to %s, please check your SSH config" msgid "unable to connect to %s, please check your SSH config"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:126 #: ./cli/recipe/release.go:136
msgid "unable to continue, input required for initial version" msgid "unable to continue, input required for initial version"
msgstr "" msgstr ""
@@ -5178,7 +5192,7 @@ msgstr ""
msgid "unable to create local context: %s" msgid "unable to create local context: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:622 #: ./cli/recipe/release.go:600
#, c-format #, c-format
msgid "unable to delete tag %s: %s" msgid "unable to delete tag %s: %s"
msgstr "" msgstr ""
@@ -5223,6 +5237,11 @@ msgstr ""
msgid "unable to git pull in %s: %s" msgid "unable to git pull in %s: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:583
#, c-format
msgid "unable to hard reset %s: %s"
msgstr ""
#: ./cli/app/env.go:158 #: ./cli/app/env.go:158
#, c-format #, c-format
msgid "unable to inspect container for %s: %s" msgid "unable to inspect container for %s: %s"
@@ -5252,12 +5271,12 @@ msgstr ""
msgid "unable to open git work tree in %s: %s" msgid "unable to open git work tree in %s: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:595 ./cli/recipe/release.go:617 #: ./cli/recipe/release.go:573 ./cli/recipe/release.go:595
#, c-format #, c-format
msgid "unable to open repo in %s: %s" msgid "unable to open repo in %s: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:600 #: ./cli/recipe/release.go:578
#, c-format #, c-format
msgid "unable to open work tree in %s: %s" msgid "unable to open work tree in %s: %s"
msgstr "" msgstr ""
@@ -5337,6 +5356,11 @@ msgstr ""
msgid "unable to render to JSON: %s" msgid "unable to render to JSON: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:303
#, c-format
msgid "unable to reset commit after failed release attempt: %s"
msgstr ""
#: ./pkg/recipe/git.go:166 #: ./pkg/recipe/git.go:166
#, c-format #, c-format
msgid "unable to resolve '%s': %s" msgid "unable to resolve '%s': %s"
@@ -5377,11 +5401,6 @@ msgstr ""
msgid "unable to setup input stream: %s" msgid "unable to setup input stream: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:605
#, c-format
msgid "unable to soft reset %s: %s"
msgstr ""
#: ./cli/internal/validate.go:84 #: ./cli/internal/validate.go:84
#, c-format #, c-format
msgid "unable to validate recipe: %s" msgid "unable to validate recipe: %s"
@@ -5551,7 +5570,7 @@ msgstr ""
msgid "use local server" msgid "use local server"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:461 #: ./cli/recipe/release.go:438
msgid "use release note in release/next?" msgid "use release note in release/next?"
msgstr "" msgstr ""
@@ -5760,7 +5779,7 @@ msgstr ""
msgid "which service are you looking for?" msgid "which service are you looking for?"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:148 #: ./cli/recipe/release.go:158
msgid "which version do you want to begin with?" msgid "which version do you want to begin with?"
msgstr "" msgstr ""
@@ -5772,7 +5791,7 @@ msgstr ""
msgid "wire up healthchecks" msgid "wire up healthchecks"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:106 #: ./cli/recipe/release.go:116
#, c-format #, c-format
msgid "working directory not clean in %s, aborting" msgid "working directory not clean in %s, aborting"
msgstr "" msgstr ""
@@ -5787,11 +5806,11 @@ msgstr ""
msgid "writing recipe version failed: %s" msgid "writing recipe version failed: %s"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:654 ./cli/recipe/upgrade.go:376 #: ./cli/recipe/release.go:632 ./cli/recipe/upgrade.go:376
msgid "x" msgid "x"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:662 ./cli/recipe/upgrade.go:384 #: ./cli/recipe/release.go:640 ./cli/recipe/upgrade.go:384
msgid "y" msgid "y"
msgstr "" msgstr ""
@@ -5799,11 +5818,11 @@ msgstr ""
msgid "you can only use one of: --major, --minor, --patch." msgid "you can only use one of: --major, --minor, --patch."
msgstr "" msgstr ""
#: ./cli/recipe/release.go:243 #: ./cli/recipe/release.go:248
msgid "you can only use one version flag: --major, --minor or --patch" msgid "you can only use one version flag: --major, --minor or --patch"
msgstr "" msgstr ""
#: ./cli/recipe/release.go:670 ./cli/recipe/upgrade.go:392 #: ./cli/recipe/release.go:648 ./cli/recipe/upgrade.go:392
msgid "z" msgid "z"
msgstr "" msgstr ""
Binary file not shown.
+184 -82
View File
@@ -1,5 +1,17 @@
msgid "" msgid ""
msgstr "Project-Id-Version: \nReport-Msgid-Bugs-To: EMAIL\nPOT-Creation-Date: 2026-02-20 14:48+0100\nPO-Revision-Date: 2026-02-21 20:37+0000\nLast-Translator: chasqui <chasqui@cryptolab.net>\nLanguage-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-cloud/abra/es/>\nLanguage: es\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nPlural-Forms: nplurals=2; plural=n != 1;\nX-Generator: Weblate 5.12.2\n" msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2026-04-11 11:34+0200\n"
"PO-Revision-Date: 2026-02-28 13:52+0000\n"
"Last-Translator: chasqui <chasqui@cryptolab.net>\n"
"Language-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-cloud/abra/es/>\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.12.2\n"
#: cli/app/cp.go:38 #: cli/app/cp.go:38
msgid "" msgid ""
@@ -8,7 +20,12 @@ msgid ""
"\n" "\n"
" # copy that file back to your current working directory locally\n" " # copy that file back to your current working directory locally\n"
" abra app cp 1312.net app:/myfile.txt ./" " abra app cp 1312.net app:/myfile.txt ./"
msgstr " # Para copiar un archivo.txt en el servicio \"app\"\n abra aplicacion copiar 1312.net archivo.txt app:/carpeta/destino/\n\n # Para copiar ese archivo de vuelta a tu directorio local actual\n abra aplicacion copiar 1312.net app:/archivo.txt ./" msgstr ""
" # Para copiar un archivo.txt en el servicio \"app\"\n"
" abra aplicacion copiar 1312.net archivo.txt app:/carpeta/destino/\n"
"\n"
" # Para copiar ese archivo de vuelta a tu directorio local actual\n"
" abra aplicacion copiar 1312.net app:/archivo.txt ./"
#: cli/app/volume.go:101 #: cli/app/volume.go:101
msgid "" msgid ""
@@ -126,7 +143,18 @@ msgid ""
"\n" "\n"
" # drop the [service] arg if using \"--local/-l\"\n" " # drop the [service] arg if using \"--local/-l\"\n"
" abra app cmd 1312.net my_cmd --local" " abra app cmd 1312.net my_cmd --local"
msgstr " # Ejecutar comandos dentro de un servicio, por ejemplo db\n abra aplicacion ejecutar 1312.net db -- sh\n\n # Para ejecutar directamente el comando sin abrir bash\n abra aplicacion ejecutar 1312.net db comando_argumento --usuario bar\n\n # Para ejecutar directamente el comando sin abrir bash con \"--\"\n abra aplicacion ejecutar 1312.net db comando_argumentos --usuario bar -- foo -vvv\n\n # Omitir el servicio si usas \"--local/-l\"\n abra aplicacion ejecutar 1312.net comando --local" msgstr ""
" # Ejecutar comandos dentro de un servicio, por ejemplo db\n"
" abra aplicacion ejecutar 1312.net db -- sh\n"
"\n"
" # Para ejecutar directamente el comando sin abrir bash\n"
" abra aplicacion ejecutar 1312.net db comando_argumento --usuario bar\n"
"\n"
" # Para ejecutar directamente el comando sin abrir bash con \"--\"\n"
" abra aplicacion ejecutar 1312.net db comando_argumentos --usuario bar -- foo -vvv\n"
"\n"
" # Omitir el servicio si usas \"--local/-l\"\n"
" abra aplicacion ejecutar 1312.net comando --local"
#: cli/app/env.go:85 #: cli/app/env.go:85
msgid "" msgid ""
@@ -149,7 +177,12 @@ msgid ""
"\n" "\n"
" # restart all app services\n" " # restart all app services\n"
" abra app restart 1312.net -a" " abra app restart 1312.net -a"
msgstr " # Reiniciar el servcio \"db\" de una aplicación\n abra aplicacion reiniciar 1312.net db\n\n # Reiniciar todos los servicios de una aplicación\n abra aplicacion reiniciar 1312.net --todos-los-servicios" msgstr ""
" # Reiniciar el servcio \"db\" de una aplicación\n"
" abra aplicacion reiniciar 1312.net db\n"
"\n"
" # Reiniciar todos los servicios de una aplicación\n"
" abra aplicacion reiniciar 1312.net --todos-los-servicios"
#: cli/app/run.go:31 #: cli/app/run.go:31
msgid "" msgid ""
@@ -161,7 +194,15 @@ msgid ""
"\n" "\n"
" # run <cmd> with both kinds of args/flags \n" " # run <cmd> with both kinds of args/flags \n"
" abra app run 1312.net app --user nobody -- ls -lha" " abra app run 1312.net app --user nobody -- ls -lha"
msgstr " # Lanzar <comando> con argumentos/opciones\n abra aplicación lanzar 1312.net app -- ls -lha\n\n # Lanzar <comando> sin args/opciones\n abra aplicación lanzar 1312.net app bash --usuario nobody\n\n # Lanzar <comando> con ambos tipos de args/opciones \n abra aplicación lanzar 1312.net app --usuario nobody -- ls -lha" msgstr ""
" # Lanzar <comando> con argumentos/opciones\n"
" abra aplicación lanzar 1312.net app -- ls -lha\n"
"\n"
" # Lanzar <comando> sin args/opciones\n"
" abra aplicación lanzar 1312.net app bash --usuario nobody\n"
"\n"
" # Lanzar <comando> con ambos tipos de args/opciones \n"
" abra aplicación lanzar 1312.net app --usuario nobody -- ls -lha"
#: cli/app/deploy.go:43 #: cli/app/deploy.go:43
msgid "" msgid ""
@@ -514,7 +555,7 @@ msgstr "%s se almacenó con éxito en el servidor"
msgid "%s was successfully moved from %s to %s 🎉" msgid "%s was successfully moved from %s to %s 🎉"
msgstr "%s se movió con éxito de %s a %s 🎉" msgstr "%s se movió con éxito de %s a %s 🎉"
#: cli/recipe/release.go:299 #: cli/recipe/release.go:294
#, c-format #, c-format
msgid "%s+... conflicts with a previous release: %s" msgid "%s+... conflicts with a previous release: %s"
msgstr "%s+... entra en conflicto con un lanzamiento anterior: %s" msgstr "%s+... entra en conflicto con un lanzamiento anterior: %s"
@@ -751,11 +792,11 @@ msgstr "COMPOSE_FILE detectado, cargando %s"
#: cli/internal/deploy.go:81 #: cli/internal/deploy.go:81
msgid "CONFIG" msgid "CONFIG"
msgstr "⚙️ CONFIGURACIÓN" msgstr "⚙️ CONFIGURACIÓN"
#: cli/internal/deploy.go:107 #: cli/internal/deploy.go:107
msgid "CONFIGS" msgid "CONFIGS"
msgstr "⚙️ CONFIGURACIONES" msgstr "⚙️ CONFIGURACIONES"
#: cli/app/secret.go:481 #: cli/app/secret.go:481
msgid "CREATED ON SERVER" msgid "CREATED ON SERVER"
@@ -806,7 +847,7 @@ msgstr ""
#. translators: Short description for `app cp` command #. translators: Short description for `app cp` command
#: cli/app/cp.go:37 #: cli/app/cp.go:37
msgid "Copy files to/from a deployed app service" msgid "Copy files to/from a deployed app service"
msgstr "↔️ Copia archivos desde/hacia una 🚀 aplicación" msgstr "↔️ Copia archivos desde/hacia una 🚀 aplicación"
#. translators: Short description for `app new` command #. translators: Short description for `app new` command
#: cli/app/new.go:55 #: cli/app/new.go:55
@@ -984,16 +1025,16 @@ msgstr ""
#: cli/app/env.go:70 #: cli/app/env.go:70
msgid "ENV OVERVIEW" msgid "ENV OVERVIEW"
msgstr "RESUMEN DEL 🎛️ ENTORNO" msgstr "🎛️ RESUMEN DEL ENTORNO"
#: cli/internal/deploy.go:84 #: cli/internal/deploy.go:84
msgid "ENV VERSION" msgid "ENV VERSION"
msgstr "VERSIÓN DEL 🎛️ ENTORNO" msgstr "🎛️ VERSIÓN DEL ENTORNO"
#. translators: Short description for `app config` command #. translators: Short description for `app config` command
#: cli/app/config.go:25 #: cli/app/config.go:25
msgid "Edit app config" msgid "Edit app config"
msgstr "⚙️ Edita las configuraciones de una 🚀 aplicación" msgstr "⚙️ Edita las configuraciones de una 🚀 aplicación"
#. translators: Short description for `app check` command #. translators: Short description for `app check` command
#: cli/app/check.go:26 #: cli/app/check.go:26
@@ -1208,41 +1249,41 @@ msgstr "RESUMEN DE MOVIMIENTOS"
#. translators: Short description for `app backup` command group #. translators: Short description for `app backup` command group
#: cli/app/backup.go:246 #: cli/app/backup.go:246
msgid "Manage app backups" msgid "Manage app backups"
msgstr "⚙️ Administrar 📸 instantáneas de la aplicación (respaldos)" msgstr "⚙️ Administrar 📸 instantáneas de la aplicación (respaldos)"
#. translators: Short description for `app env` command group #. translators: Short description for `app env` command group
#: cli/app/env.go:314 #: cli/app/env.go:314
msgid "Manage app environment values" msgid "Manage app environment values"
msgstr "⚙️ Administrar 🎛️ valores del entorno de la aplicación" msgstr "⚙️ Administrar 🎛️ valores del entorno de la aplicación"
#. translators: Short description for `app secret` command group #. translators: Short description for `app secret` command group
#: cli/app/secret.go:537 #: cli/app/secret.go:537
msgid "Manage app secrets" msgid "Manage app secrets"
msgstr "⚙️ Administrar 🥷 secretos de la aplicación" msgstr "⚙️ Administrar 🥷 secretos de la aplicación"
#: cli/app/volume.go:210 #: cli/app/volume.go:210
msgid "Manage app volumes" msgid "Manage app volumes"
msgstr "⚙️ Administrar 📦 volúmenes de la aplicación" msgstr "⚙️ Administrar 📦 volúmenes de la aplicación"
#. translators: Short description for `app` command group #. translators: Short description for `app` command group
#: cli/app/app.go:19 #: cli/app/app.go:19
msgid "Manage apps" msgid "Manage apps"
msgstr "⚙️ Administrar 🚀 aplicaciones" msgstr "⚙️ Administrar 🚀 aplicaciones"
#. translators: Short description for `recipe` command group #. translators: Short description for `recipe` command group
#: cli/recipe/recipe.go:20 #: cli/recipe/recipe.go:20
msgid "Manage recipes" msgid "Manage recipes"
msgstr "⚙️ Administrar 📜 recetas" msgstr "⚙️ Administrar 📜 recetas"
#. translators: Short description for `server` command group #. translators: Short description for `server` command group
#: cli/server/server.go:20 #: cli/server/server.go:20
msgid "Manage servers" msgid "Manage servers"
msgstr "⚙️ Administrar 🕋 servidores" msgstr "⚙️ Administrar 🕋 servidores"
#. translators: Short description for `catalogue` command group #. translators: Short description for `catalogue` command group
#: cli/catalogue/catalogue.go:281 #: cli/catalogue/catalogue.go:281
msgid "Manage the recipe catalogue" msgid "Manage the recipe catalogue"
msgstr "⚙️ Administrar 📓 catálogo de 📜 recetas" msgstr "⚙️ Administrar 📓 catálogo de 📜 recetas"
#: cli/app/move.go:42 #: cli/app/move.go:42
msgid "" msgid ""
@@ -1288,7 +1329,7 @@ msgstr ""
#. translators: Short description for `app move` command #. translators: Short description for `app move` command
#: cli/app/move.go:41 #: cli/app/move.go:41
msgid "Moves an app to a different server" msgid "Moves an app to a different server"
msgstr "Mueve la aplicación a un servidor diferente" msgstr "🚚 Mueve la 🚀 aplicación a un 🕋 servidor diferente"
#: cli/recipe/new.go:123 #: cli/recipe/new.go:123
msgid "N" msgid "N"
@@ -1301,7 +1342,7 @@ msgstr "NOMBRE"
#: cli/internal/deploy.go:160 #: cli/internal/deploy.go:160
msgid "NEW DEPLOY" msgid "NEW DEPLOY"
msgstr "📤 NUEVO PROCESO DE DESPLIEGUE" msgstr "📤 NUEVO DESPLIEGUE"
#: cli/internal/deploy.go:85 #: cli/internal/deploy.go:85
msgid "NEW DEPLOYMENT" msgid "NEW DEPLOYMENT"
@@ -1327,7 +1368,7 @@ msgstr "SERVIDOR ANTIGUO"
msgid "ON SERVER" msgid "ON SERVER"
msgstr "EN EL SERVIDOR" msgstr "EN EL SERVIDOR"
#: cli/recipe/release.go:176 #: cli/recipe/release.go:186
msgid "PROPOSED CHANGES" msgid "PROPOSED CHANGES"
msgstr "CAMBIOS PROPUESTOS" msgstr "CAMBIOS PROPUESTOS"
@@ -1495,7 +1536,7 @@ msgstr "🔂 Reiniciar una 🚀 aplicación"
#. translators: Short description for `app restore` command #. translators: Short description for `app restore` command
#: cli/app/restore.go:24 #: cli/app/restore.go:24
msgid "Restore a snapshot" msgid "Restore a snapshot"
msgstr "▶️ Restaurar una 📸 instantánea (respaldo)" msgstr "▶️ Restaurar una 📸 instantánea (respaldo)"
#. translators: Short description for `app rollback` command #. translators: Short description for `app rollback` command
#: cli/app/rollback.go:34 #: cli/app/rollback.go:34
@@ -1519,7 +1560,18 @@ msgid ""
"be passed *before* the \"--\". It is possible to pass arguments without the \"--\"\n" "be passed *before* the \"--\". It is possible to pass arguments without the \"--\"\n"
"as long as no dashes are present (i.e. \"foo\" works without \"--\", \"-foo\"\n" "as long as no dashes are present (i.e. \"foo\" works without \"--\", \"-foo\"\n"
"does not)." "does not)."
msgstr "Ejecuta un comando específico dentro de la aplicación.\n\nEsos comandos son funciones de bash. Se pueden ejecutar \nen el contexto de un servicio (por ejemplo, app, db, web) \no localmente en tu estación de trabajo agregando \"--local/-l\".\n\nNota: si usas el estilo \"--\" para poner argumentos, \nlas opciones (p. ej. \"--local/-l\") deben ir *antes* del \"--\". \nTambién puedes pasar argumentos sin el \"--\" siempre \nque no tengan guiones. \n(p. ej. \"foo\" funciona sin \"--\", \"-foo\" no)." msgstr ""
"Ejecuta un comando específico dentro de la aplicación.\n"
"\n"
"Esos comandos son funciones de bash. Se pueden ejecutar \n"
"en el contexto de un servicio (por ejemplo, app, db, web) \n"
"o localmente en tu estación de trabajo agregando \"--local/-l\".\n"
"\n"
"Nota: si usas el estilo \"--\" para poner argumentos, \n"
"las opciones (p. ej. \"--local/-l\") deben ir *antes* del \"--\". \n"
"También puedes pasar argumentos sin el \"--\" siempre \n"
"que no tengan guiones. \n"
"(p. ej. \"foo\" funciona sin \"--\", \"-foo\" no)."
#. translators: Short description for `app cmd` command #. translators: Short description for `app cmd` command
#: cli/app/cmd.go:30 #: cli/app/cmd.go:30
@@ -1543,7 +1595,7 @@ msgstr "RESUMEN DE LOS 🥷 SECRETOS"
msgid "SERVER" msgid "SERVER"
msgstr "🕋 SERVIDOR" msgstr "🕋 SERVIDOR"
#: cli/app/ps.go:185 cli/recipe/release.go:176 cli/recipe/version.go:69 #: cli/app/ps.go:185 cli/recipe/release.go:186 cli/recipe/version.go:69
#: cli/recipe/version.go:110 #: cli/recipe/version.go:110
msgid "SERVICE" msgid "SERVICE"
msgstr "🔥 SERVICIO" msgstr "🔥 SERVICIO"
@@ -1585,7 +1637,7 @@ msgstr "📋 Lista las 📑 etiquetas desplegadas (proxy)"
#. translators: Short description for `recipe diff` command #. translators: Short description for `recipe diff` command
#: cli/recipe/diff.go:23 #: cli/recipe/diff.go:23
msgid "Show unstaged changes in recipe config" msgid "Show unstaged changes in recipe config"
msgstr "📋Muestra cambios sin actualizar en la configuración de la 📜 receta" msgstr "📋 Muestra cambios sin actualizar en la configuración de la 📜 receta"
#: cli/app/restore.go:25 #: cli/app/restore.go:25
msgid "" msgid ""
@@ -1972,7 +2024,33 @@ msgid ""
" {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}\n" " {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}\n"
"\n" "\n"
"Use \"{{.CommandPath}} [command] --help\" for more information about a command.{{end}}\n" "Use \"{{.CommandPath}} [command] --help\" for more information about a command.{{end}}\n"
msgstr "Uso:{{if .Runnable}}\n {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}\n {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}\n\nComando:\n {{.NameAndAliases}}{{end}}{{if .HasExample}}\n\nEjemplos:\n # Nota: \"1312.net\" es solo un ejemplo de nombre de aplicación.\n# Reemplázalo por el dominio o nombre real de tu aplicación.\n\n{{.Example}}{{end}}{{if .HasAvailableSubCommands}}\n\nComandos disponibles:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name \"help\"))}}\n {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}\n\nOpciones:\n{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}\n\nOpciones globales:\n{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}\n\nTemas de ayuda adicionales:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}\n {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}\n\nUse \"{{.CommandPath}} [command] --help\" para más información sobre un comando.{{end}}\n" msgstr ""
"Uso:{{if .Runnable}}\n"
" {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}\n"
" {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}\n"
"\n"
"Comando:\n"
" {{.NameAndAliases}}{{end}}{{if .HasExample}}\n"
"\n"
"Ejemplos:\n"
" # Nota: \"1312.net\" es solo un ejemplo de nombre de aplicación.\n"
"# Reemplázalo por el dominio o nombre real de tu aplicación.\n"
"\n"
"{{.Example}}{{end}}{{if .HasAvailableSubCommands}}\n"
"\n"
"Comandos disponibles:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name \"help\"))}}\n"
" {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}\n"
"\n"
"Opciones:\n"
"{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}\n"
"\n"
"Opciones globales:\n"
"{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}\n"
"\n"
"Temas de ayuda adicionales:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}\n"
" {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}\n"
"\n"
"Use \"{{.CommandPath}} [command] --help\" para más información sobre un comando.{{end}}\n"
#: cli/recipe/fetch.go:28 #: cli/recipe/fetch.go:28
msgid "Using \"--force/-f\" Git syncs an existing recipe. It does not erase unstaged changes." msgid "Using \"--force/-f\" Git syncs an existing recipe. It does not erase unstaged changes."
@@ -2003,7 +2081,7 @@ msgstr "[hijack] Fin de stdin"
msgid "[hijack] end of stdout" msgid "[hijack] end of stdout"
msgstr "[hijack] Fin de stdout" msgstr "[hijack] Fin de stdout"
#: cli/recipe/release.go:128 #: cli/recipe/release.go:138
#, c-format #, c-format
msgid "" msgid ""
"\n" "\n"
@@ -2201,7 +2279,7 @@ msgstr "agrega '- \"%s\"' manualmente al servicio de la 'app' en %s"
msgid "add [[server] | --local] [flags]" msgid "add [[server] | --local] [flags]"
msgstr "agregar [[servidor] | --local] [opciones]" msgstr "agregar [[servidor] | --local] [opciones]"
#: cli/recipe/release.go:495 #: cli/recipe/release.go:472
msgid "add release note? (leave empty to skip)" msgid "add release note? (leave empty to skip)"
msgstr "¿Agregar nota de versión? (dejar vacío para omitir)" msgstr "¿Agregar nota de versión? (dejar vacío para omitir)"
@@ -2262,7 +2340,7 @@ msgstr "aplicacion [comando] [argumento] [opciones]"
msgid "app domain %s (%s) does not appear to resolve to app server %s (%s)?" msgid "app domain %s (%s) does not appear to resolve to app server %s (%s)?"
msgstr "¿El dominio de la aplicación %s (%s) no parece resolverse al servidor de la aplicación %s (%s)?" msgstr "¿El dominio de la aplicación %s (%s) no parece resolverse al servidor de la aplicación %s (%s)?"
#: cli/recipe/release.go:363 #: cli/recipe/release.go:349
msgid "app service is missing image tag?" msgid "app service is missing image tag?"
msgstr "¿A la aplicación le falta la etiqueta de imagen?" msgstr "¿A la aplicación le falta la etiqueta de imagen?"
@@ -2438,14 +2516,16 @@ msgstr "no se puede redeplegar la versión anterior de caos (%s), ¿Era tu inten
msgid "" msgid ""
"cannot redeploy previous chaos version (%s), did you mean to use \"--chaos\"?\n" "cannot redeploy previous chaos version (%s), did you mean to use \"--chaos\"?\n"
" to return to a regular release, specify a release tag, commit SHA or use \"--latest\"" " to return to a regular release, specify a release tag, commit SHA or use \"--latest\""
msgstr "no se puede redesplegar la versión anterior de caos (%s), ¿Era tu intención usar \"--caos\"? \npara volver a un lanzamiento regular, especifica una etiqueta de lanzamiento, SHA de commit o agrega el comando \"--latest\"" msgstr ""
"no se puede redesplegar la versión anterior de caos (%s), ¿Era tu intención usar \"--caos\"? \n"
"para volver a un lanzamiento regular, especifica una etiqueta de lanzamiento, SHA de commit o agrega el comando \"--latest\""
#: pkg/dns/dns.go:38 pkg/dns/dns.go:47 #: pkg/dns/dns.go:38 pkg/dns/dns.go:47
#, c-format #, c-format
msgid "cannot resolve ipv4 for %s?" msgid "cannot resolve ipv4 for %s?"
msgstr "no se puede resolver ipv4 para %s?" msgstr "no se puede resolver ipv4 para %s?"
#: cli/recipe/release.go:120 #: cli/recipe/release.go:130
msgid "cannot specify tag and bump type at the same time" msgid "cannot specify tag and bump type at the same time"
msgstr "no se puede especificar una etiqueta y un tipo de incremento al mismo tiempo" msgstr "no se puede especificar una etiqueta y un tipo de incremento al mismo tiempo"
@@ -2552,7 +2632,7 @@ msgstr ""
msgid "choosing %s as latest version of %s" msgid "choosing %s as latest version of %s"
msgstr "eligiendo %s como la última versión de %s" msgstr "eligiendo %s como la última versión de %s"
#: cli/recipe/release.go:277 #: cli/recipe/release.go:282
#, c-format #, c-format
msgid "choosing %s as new version for %s" msgid "choosing %s as new version for %s"
msgstr "eligiendo %s como nueva versión para %s" msgstr "eligiendo %s como nueva versión para %s"
@@ -2567,7 +2647,7 @@ msgstr "eligiendo %s como versión para revertir"
msgid "choosing %s as version to upgrade" msgid "choosing %s as version to upgrade"
msgstr "eligiendo %s como versión para actualizar" msgstr "eligiendo %s como versión para actualizar"
#: cli/recipe/release.go:427 #: cli/recipe/release.go:404
#, c-format #, c-format
msgid "chore: publish %s release" msgid "chore: publish %s release"
msgstr "tarea: publicar versión %s" msgstr "tarea: publicar versión %s"
@@ -2726,7 +2806,7 @@ msgstr "el contexto para %s ya existe"
msgid "context lacks Docker endpoint" msgid "context lacks Docker endpoint"
msgstr "el contexto no tiene punto final de Docker" msgstr "el contexto no tiene punto final de Docker"
#: cli/recipe/release.go:286 pkg/recipe/compose.go:229 #: pkg/recipe/compose.go:229
#, c-format #, c-format
msgid "coop-cloud.${STACK_NAME}.version=%s" msgid "coop-cloud.${STACK_NAME}.version=%s"
msgstr "" msgstr ""
@@ -2790,7 +2870,7 @@ msgstr "creado cliente para %s"
msgid "created secret on %s: %s" msgid "created secret on %s: %s"
msgstr "secreto creado en %s: %s" msgstr "secreto creado en %s: %s"
#: cli/recipe/release.go:565 #: cli/recipe/release.go:542
#, c-format #, c-format
msgid "created tag %s at %s" msgid "created tag %s at %s"
msgstr "creada etiqueta %s en %s" msgstr "creada etiqueta %s en %s"
@@ -3039,7 +3119,7 @@ msgstr "ejecución de prueba"
msgid "dry run: adding %s" msgid "dry run: adding %s"
msgstr "ejecución de prueba: añadiendo %s" msgstr "ejecución de prueba: añadiendo %s"
#: cli/recipe/release.go:455 #: cli/recipe/release.go:432
#, c-format #, c-format
msgid "dry run: move release note from 'next' to %s" msgid "dry run: move release note from 'next' to %s"
msgstr "ejecución de prueba: mover la nota de la versión de 'next' a %s" msgstr "ejecución de prueba: mover la nota de la versión de 'next' a %s"
@@ -3048,11 +3128,11 @@ msgstr "ejecución de prueba: mover la nota de la versión de 'next' a %s"
msgid "dry run: no changes commited" msgid "dry run: no changes commited"
msgstr "ejecución de prueba: no se confirmaron cambios" msgstr "ejecución de prueba: no se confirmaron cambios"
#: cli/recipe/release.go:520 #: cli/recipe/release.go:497
msgid "dry run: no changes committed" msgid "dry run: no changes committed"
msgstr "ejecución de prueba: ningún cambio confirmado" msgstr "ejecución de prueba: ningún cambio confirmado"
#: cli/catalogue/catalogue.go:271 cli/recipe/release.go:572 #: cli/catalogue/catalogue.go:271 cli/recipe/release.go:549
msgid "dry run: no changes published" msgid "dry run: no changes published"
msgstr "ejecución de prueba: no se publicaron cambios" msgstr "ejecución de prueba: no se publicaron cambios"
@@ -3061,12 +3141,12 @@ msgstr "ejecución de prueba: no se publicaron cambios"
msgid "dry run: no git changes pushed in %s" msgid "dry run: no git changes pushed in %s"
msgstr "ejecución de prueba: no se enviaron cambios de git (push) en %s" msgstr "ejecución de prueba: no se enviaron cambios de git (push) en %s"
#: cli/recipe/release.go:545 #: cli/recipe/release.go:522
#, c-format #, c-format
msgid "dry run: no git tag created (%s)" msgid "dry run: no git tag created (%s)"
msgstr "ejecución de prueba: no se creó etiqueta de git (%s)" msgstr "ejecución de prueba: no se creó etiqueta de git (%s)"
#: cli/recipe/release.go:292 #: cli/recipe/release.go:371
#, c-format #, c-format
msgid "dry run: not syncing label %s for recipe %s" msgid "dry run: not syncing label %s for recipe %s"
msgstr "ejecución de prueba: no se sincronizará la etiqueta %s para la receta %s" msgstr "ejecución de prueba: no se sincronizará la etiqueta %s para la receta %s"
@@ -3076,7 +3156,7 @@ msgstr "ejecución de prueba: no se sincronizará la etiqueta %s para la receta
msgid "dry run: remote %s (%s) not created" msgid "dry run: remote %s (%s) not created"
msgstr "ejecución de prueba: remoto %s (%s) no creado" msgstr "ejecución de prueba: remoto %s (%s) no creado"
#: cli/app/move.go:349 cli/catalogue/catalogue.go:301 cli/recipe/release.go:645 #: cli/app/move.go:349 cli/catalogue/catalogue.go:301 cli/recipe/release.go:623
msgid "dry-run" msgid "dry-run"
msgstr "ejecucion-de-prueba" msgstr "ejecucion-de-prueba"
@@ -3214,7 +3294,7 @@ msgstr "extrayendo secreto %s en %s"
msgid "f" msgid "f"
msgstr "" msgstr ""
#: cli/recipe/release.go:398 #: cli/recipe/release.go:375
#, c-format #, c-format
msgid "failed to add release notes: %s" msgid "failed to add release notes: %s"
msgstr "🛑 error al agregar notas de la versión: %s" msgstr "🛑 error al agregar notas de la versión: %s"
@@ -3234,7 +3314,7 @@ msgstr "🛑 error al cambiar a %s en %s"
msgid "failed to check out %s in %s: %s" msgid "failed to check out %s in %s: %s"
msgstr "🛑 error al cambiar a %s en %s: %s" msgstr "🛑 error al cambiar a %s en %s: %s"
#: cli/recipe/release.go:402 #: cli/recipe/release.go:379
#, c-format #, c-format
msgid "failed to commit changes: %s" msgid "failed to commit changes: %s"
msgstr "🛑 error al hacer commit: %s" msgstr "🛑 error al hacer commit: %s"
@@ -3322,7 +3402,7 @@ msgstr "🛑 error al analizar la imagen %s; detectado: %s"
msgid "failed to parse image for %s in %s: %s" msgid "failed to parse image for %s in %s: %s"
msgstr "🛑 error al analizar la imagen %s; en: %s: %s" msgstr "🛑 error al analizar la imagen %s; en: %s: %s"
#: cli/recipe/release.go:410 #: cli/recipe/release.go:387
#, c-format #, c-format
msgid "failed to publish new release: %s" msgid "failed to publish new release: %s"
msgstr "🛑 error al publicar la nueva versión: %s" msgstr "🛑 error al publicar la nueva versión: %s"
@@ -3391,7 +3471,7 @@ msgstr "🛑 error al seleccionar la rama predeterminada en %s"
msgid "failed to store secret on %s: %s" msgid "failed to store secret on %s: %s"
msgstr "🛑 no se pudo almacenar el secreto en %s: %s" msgstr "🛑 no se pudo almacenar el secreto en %s: %s"
#: cli/recipe/release.go:406 #: cli/recipe/release.go:383
#, c-format #, c-format
msgid "failed to tag release: %s" msgid "failed to tag release: %s"
msgstr "🛑 error al etiquetar la versión: %s" msgstr "🛑 error al etiquetar la versión: %s"
@@ -3771,15 +3851,15 @@ msgstr "incluyendo VOLUMES=%s en la invocación de backupbot exec"
msgid "including VOLUMES=%v in backupbot exec invocation" msgid "including VOLUMES=%v in backupbot exec invocation"
msgstr "incluyendo VOLUMES=%v en la invocación de backupbot exec" msgstr "incluyendo VOLUMES=%v en la invocación de backupbot exec"
#: cli/recipe/release.go:656 cli/recipe/upgrade.go:378 #: cli/recipe/release.go:634 cli/recipe/upgrade.go:378
msgid "increase the major part of the version" msgid "increase the major part of the version"
msgstr "incrementar la parte mayor de la versión" msgstr "incrementar la parte mayor de la versión"
#: cli/recipe/release.go:664 cli/recipe/upgrade.go:386 #: cli/recipe/release.go:642 cli/recipe/upgrade.go:386
msgid "increase the minor part of the version" msgid "increase the minor part of the version"
msgstr "incrementar la parte menor de la versión" msgstr "incrementar la parte menor de la versión"
#: cli/recipe/release.go:672 cli/recipe/upgrade.go:394 #: cli/recipe/release.go:650 cli/recipe/upgrade.go:394
msgid "increase the patch part of the version" msgid "increase the patch part of the version"
msgstr "incrementar la parte de parche de la versión" msgstr "incrementar la parte de parche de la versión"
@@ -3871,7 +3951,7 @@ msgstr "receta inválida: %s"
msgid "invalid tmpfs source, source must be empty" msgid "invalid tmpfs source, source must be empty"
msgstr "fuente tmpfs inválida, la fuente debe estar vacía" msgstr "fuente tmpfs inválida, la fuente debe estar vacía"
#: cli/recipe/release.go:282 #: cli/recipe/release.go:287
#, c-format #, c-format
msgid "invalid version %s specified" msgid "invalid version %s specified"
msgstr "versión %s especificada inválida" msgstr "versión %s especificada inválida"
@@ -4037,7 +4117,7 @@ msgid "main app service version for %s is empty?"
msgstr "¿la versión del servicio principal de la aplicación para %s está vacía?" msgstr "¿la versión del servicio principal de la aplicación para %s está vacía?"
#: cli/internal/recipe.go:48 cli/internal/recipe.go:66 #: cli/internal/recipe.go:48 cli/internal/recipe.go:66
#: cli/internal/recipe.go:80 cli/recipe/release.go:653 #: cli/internal/recipe.go:80 cli/recipe/release.go:631
#: cli/recipe/upgrade.go:375 #: cli/recipe/upgrade.go:375
msgid "major" msgid "major"
msgstr "mayor" msgstr "mayor"
@@ -4068,7 +4148,7 @@ msgid "migrating app config from %s to %s"
msgstr "migrando la configuración de la aplicación de %s a %s" msgstr "migrando la configuración de la aplicación de %s a %s"
#: cli/internal/recipe.go:48 cli/internal/recipe.go:68 #: cli/internal/recipe.go:48 cli/internal/recipe.go:68
#: cli/internal/recipe.go:82 cli/recipe/release.go:661 #: cli/internal/recipe.go:82 cli/recipe/release.go:639
#: cli/recipe/upgrade.go:383 #: cli/recipe/upgrade.go:383
msgid "minor" msgid "minor"
msgstr "menor" msgstr "menor"
@@ -4168,7 +4248,7 @@ msgstr "nuevos cambios publicados: %s"
msgid "new recipe '%s' created: %s" msgid "new recipe '%s' created: %s"
msgstr "nueva receta '%s' creada: %s" msgstr "nueva receta '%s' creada: %s"
#: cli/recipe/release.go:585 #: cli/recipe/release.go:562
#, c-format #, c-format
msgid "new release published: %s" msgid "new release published: %s"
msgstr "nueva versión publicada: %s" msgstr "nueva versión publicada: %s"
@@ -4219,7 +4299,7 @@ msgstr "no hay actualizaciones disponibles"
msgid "no backupbot discovered, is it deployed?" msgid "no backupbot discovered, is it deployed?"
msgstr "no se descubrió backupbot, ¿está desplegado?" msgstr "no se descubrió backupbot, ¿está desplegado?"
#: cli/catalogue/catalogue.go:231 cli/recipe/release.go:531 #: cli/catalogue/catalogue.go:231 cli/recipe/release.go:508
#, c-format #, c-format
msgid "no changes discovered in %s, nothing to publish?" msgid "no changes discovered in %s, nothing to publish?"
msgstr "no se descubrieron cambios en %s, ¿nada que publicar?" msgstr "no se descubrieron cambios en %s, ¿nada que publicar?"
@@ -4253,7 +4333,7 @@ msgstr "no se proporcionó dominio"
msgid "no existing label found, automagic insertion not supported yet" msgid "no existing label found, automagic insertion not supported yet"
msgstr "no se encontró ninguna etiqueta existente, la inserción automágica no es compatible aún" msgstr "no se encontró ninguna etiqueta existente, la inserción automágica no es compatible aún"
#: cli/recipe/release.go:124 #: cli/recipe/release.go:134
#, c-format #, c-format
msgid "no git tags found for %s" msgid "no git tags found for %s"
msgstr "no se encontraron etiquetas de git para %s" msgstr "no se encontraron etiquetas de git para %s"
@@ -4272,6 +4352,11 @@ msgstr "¿no existe la receta '%s'?"
msgid "no recipe name provided" msgid "no recipe name provided"
msgstr "no se proporcionó el nombre de la receta" msgstr "no se proporcionó el nombre de la receta"
#: cli/app/upgrade.go:241
#, fuzzy, c-format
msgid "no release notes for upgrading from %s to %s"
msgstr "ejecución de prueba: mover la nota de la versión de 'next' a %s"
#: cli/app/secret.go:234 #: cli/app/secret.go:234
#, c-format #, c-format
msgid "no secret %s available for recipe %s?" msgid "no secret %s available for recipe %s?"
@@ -4492,7 +4577,7 @@ msgid "pass command not found on $PATH, is it installed?"
msgstr "comando pass no encontrado en $PATH, ¿está instalado?" msgstr "comando pass no encontrado en $PATH, ¿está instalado?"
#: cli/internal/recipe.go:48 cli/internal/recipe.go:70 #: cli/internal/recipe.go:48 cli/internal/recipe.go:70
#: cli/internal/recipe.go:84 cli/recipe/release.go:669 #: cli/internal/recipe.go:84 cli/recipe/release.go:647
#: cli/recipe/upgrade.go:391 #: cli/recipe/upgrade.go:391
msgid "patch" msgid "patch"
msgstr "parche" msgstr "parche"
@@ -4618,7 +4703,7 @@ msgstr "consultando servidores remotos..."
#. with no spaces in between #. with no spaces in between
#: cli/app/backup.go:327 cli/app/list.go:304 cli/app/move.go:350 #: cli/app/backup.go:327 cli/app/list.go:304 cli/app/move.go:350
#: cli/app/run.go:23 cli/app/upgrade.go:486 cli/catalogue/catalogue.go:302 #: cli/app/run.go:23 cli/app/upgrade.go:486 cli/catalogue/catalogue.go:302
#: cli/recipe/recipe.go:12 cli/recipe/release.go:646 #: cli/recipe/recipe.go:12 cli/recipe/release.go:624
msgid "r" msgid "r"
msgstr "" msgstr ""
@@ -4738,6 +4823,10 @@ msgstr ""
msgid "release <recipe> [version] [flags]" msgid "release <recipe> [version] [flags]"
msgstr "publicar <receta> [version] [opciones]" msgstr "publicar <receta> [version] [opciones]"
#: cli/recipe/release.go:306
msgid "release failed. any changes made have been reverted"
msgstr ""
#: cli/app/upgrade.go:485 #: cli/app/upgrade.go:485
msgid "releasenotes" msgid "releasenotes"
msgstr "notas de la versión" msgstr "notas de la versión"
@@ -4798,11 +4887,7 @@ msgstr "eliminado el repositorio .git en %s"
msgid "removed dirty suffix from .env version: %s -> %s" msgid "removed dirty suffix from .env version: %s -> %s"
msgstr "eliminado sufijo sucio de la versión .env: %s -> %s" msgstr "eliminado sufijo sucio de la versión .env: %s -> %s"
#: cli/recipe/release.go:608 #: cli/recipe/release.go:604
msgid "removed freshly created commit"
msgstr "eliminado commit recién creado"
#: cli/recipe/release.go:626
#, c-format #, c-format
msgid "removed freshly created tag %s" msgid "removed freshly created tag %s"
msgstr "eliminada etiqueta recién creada %s" msgstr "eliminada etiqueta recién creada %s"
@@ -4874,7 +4959,7 @@ msgstr "configuración del repositorio: %s"
msgid "repo set config: %s" msgid "repo set config: %s"
msgstr "configuración del repositorio establecida: %s" msgstr "configuración del repositorio establecida: %s"
#: cli/app/move.go:352 cli/catalogue/catalogue.go:304 cli/recipe/release.go:648 #: cli/app/move.go:352 cli/catalogue/catalogue.go:304 cli/recipe/release.go:626
msgid "report changes that would be made" msgid "report changes that would be made"
msgstr "informar sobre los cambios que se realizarían" msgstr "informar sobre los cambios que se realizarían"
@@ -4895,6 +4980,10 @@ msgstr "requiere al menos 3 argumentos"
msgid "reset <recipe> [flags]" msgid "reset <recipe> [flags]"
msgstr "resetear <receta> [opciones]" msgstr "resetear <receta> [opciones]"
#: cli/recipe/release.go:586
msgid "reset commit to pre-release state"
msgstr ""
#: cli/recipe/lint.go:45 #: cli/recipe/lint.go:45
msgid "resolve" msgid "resolve"
msgstr "resolver" msgstr "resolver"
@@ -5445,7 +5534,7 @@ msgstr "la conexión al host SSH no es válida"
msgid "ssh url: %s, " msgid "ssh url: %s, "
msgstr "" msgstr ""
#: cli/recipe/release.go:577 #: cli/recipe/release.go:554
msgid "ssh-agent not found. see \"abra recipe release --help\" and try again" msgid "ssh-agent not found. see \"abra recipe release --help\" and try again"
msgstr "ssh-agent no encontrado. consulta \"abra receta publicar --ayuda\" y vuelve a intentarlo" msgstr "ssh-agent no encontrado. consulta \"abra receta publicar --ayuda\" y vuelve a intentarlo"
@@ -5526,7 +5615,7 @@ msgstr ""
msgid "tag all images with stable tags" msgid "tag all images with stable tags"
msgstr "etiquetar todas las imágenes con etiquetas estables" msgstr "etiquetar todas las imágenes con etiquetas estables"
#: cli/recipe/release.go:218 #: cli/recipe/release.go:223
#, c-format #, c-format
msgid "tag at commit %s is unannotated or otherwise broken" msgid "tag at commit %s is unannotated or otherwise broken"
msgstr "la etiqueta en el commit %s no está anotada o está dañada" msgstr "la etiqueta en el commit %s no está anotada o está dañada"
@@ -5660,6 +5749,11 @@ msgstr "no se pudo cambiar a la rama predeterminada en %s: %s"
msgid "unable to clean up git clone of %s: %s" msgid "unable to clean up git clone of %s: %s"
msgstr "no se pudo limpiar la clonación de Git de %s: %s" msgstr "no se pudo limpiar la clonación de Git de %s: %s"
#: cli/recipe/release.go:300
#, fuzzy, c-format
msgid "unable to clean up tag after failed release attempt: %s"
msgstr "no se pudo limpiar la clonación de Git de %s: %s"
#: cli/app/list.go:152 #: cli/app/list.go:152
#, c-format #, c-format
msgid "unable to clone %s: %s" msgid "unable to clone %s: %s"
@@ -5670,7 +5764,7 @@ msgstr "no se pudo clonar %s: %s"
msgid "unable to connect to %s, please check your SSH config" msgid "unable to connect to %s, please check your SSH config"
msgstr "no se pudo conectar a %s; por favor revisa tu configuración SSH" msgstr "no se pudo conectar a %s; por favor revisa tu configuración SSH"
#: cli/recipe/release.go:126 #: cli/recipe/release.go:136
msgid "unable to continue, input required for initial version" msgid "unable to continue, input required for initial version"
msgstr "no se puede continuar; se requiere entrada para la versión inicial" msgstr "no se puede continuar; se requiere entrada para la versión inicial"
@@ -5694,7 +5788,7 @@ msgstr "no se pudo crear %s: %s"
msgid "unable to create local context: %s" msgid "unable to create local context: %s"
msgstr "no se pudo crear el contexto local: %s" msgstr "no se pudo crear el contexto local: %s"
#: cli/recipe/release.go:622 #: cli/recipe/release.go:600
#, c-format #, c-format
msgid "unable to delete tag %s: %s" msgid "unable to delete tag %s: %s"
msgstr "no se pudo eliminar la etiqueta %s: %s" msgstr "no se pudo eliminar la etiqueta %s: %s"
@@ -5739,6 +5833,11 @@ msgstr "no se pudo obtener el contenedor que coincide con %s: %s"
msgid "unable to git pull in %s: %s" msgid "unable to git pull in %s: %s"
msgstr "no se pudo hacer git pull en %s: %s" msgstr "no se pudo hacer git pull en %s: %s"
#: cli/recipe/release.go:583
#, fuzzy, c-format
msgid "unable to hard reset %s: %s"
msgstr "no se pudo hacer un soft reset en %s: %s"
#: cli/app/env.go:158 #: cli/app/env.go:158
#, c-format #, c-format
msgid "unable to inspect container for %s: %s" msgid "unable to inspect container for %s: %s"
@@ -5769,12 +5868,12 @@ msgstr "no se pudo abrir %s: %s"
msgid "unable to open git work tree in %s: %s" msgid "unable to open git work tree in %s: %s"
msgstr "no se pudo abrir el git work tree en %s: %s" msgstr "no se pudo abrir el git work tree en %s: %s"
#: cli/recipe/release.go:595 cli/recipe/release.go:617 #: cli/recipe/release.go:573 cli/recipe/release.go:595
#, c-format #, c-format
msgid "unable to open repo in %s: %s" msgid "unable to open repo in %s: %s"
msgstr "no se pudo abrir el repositorio en %s: %s" msgstr "no se pudo abrir el repositorio en %s: %s"
#: cli/recipe/release.go:600 #: cli/recipe/release.go:578
#, c-format #, c-format
msgid "unable to open work tree in %s: %s" msgid "unable to open work tree in %s: %s"
msgstr "no se pudo abrir el work tree en %s: %s" msgstr "no se pudo abrir el work tree en %s: %s"
@@ -5855,6 +5954,11 @@ msgstr "no se pudo eliminar el volumen: ¿no existe un volumen con el nombre '%s
msgid "unable to render to JSON: %s" msgid "unable to render to JSON: %s"
msgstr "no se pudo renderizar a JSON: %s" msgstr "no se pudo renderizar a JSON: %s"
#: cli/recipe/release.go:303
#, fuzzy, c-format
msgid "unable to reset commit after failed release attempt: %s"
msgstr "no se pudo establecer los streams de IO como terminal raw: %s"
#: pkg/recipe/git.go:166 #: pkg/recipe/git.go:166
#, c-format #, c-format
msgid "unable to resolve '%s': %s" msgid "unable to resolve '%s': %s"
@@ -5895,11 +5999,6 @@ msgstr "no se pudo establecer el remoto SSH en %s: %s"
msgid "unable to setup input stream: %s" msgid "unable to setup input stream: %s"
msgstr "no se pudo configurar el stream de entrada: %s" msgstr "no se pudo configurar el stream de entrada: %s"
#: cli/recipe/release.go:605
#, c-format
msgid "unable to soft reset %s: %s"
msgstr "no se pudo hacer un soft reset en %s: %s"
#: cli/internal/validate.go:84 #: cli/internal/validate.go:84
#, c-format #, c-format
msgid "unable to validate recipe: %s" msgid "unable to validate recipe: %s"
@@ -6072,7 +6171,7 @@ msgstr "usar una etiqueta para todas las imágenes"
msgid "use local server" msgid "use local server"
msgstr "usar servidor local" msgstr "usar servidor local"
#: cli/recipe/release.go:461 #: cli/recipe/release.go:438
msgid "use release note in release/next?" msgid "use release note in release/next?"
msgstr "¿Usar la nota de la versión en release/next?" msgstr "¿Usar la nota de la versión en release/next?"
@@ -6285,7 +6384,7 @@ msgstr "¿Qué editor de texto deseas usar?"
msgid "which service are you looking for?" msgid "which service are you looking for?"
msgstr "¿qué servicio estás buscando?" msgstr "¿qué servicio estás buscando?"
#: cli/recipe/release.go:148 #: cli/recipe/release.go:158
msgid "which version do you want to begin with?" msgid "which version do you want to begin with?"
msgstr "¿Con cuál versión quieres comenzar?" msgstr "¿Con cuál versión quieres comenzar?"
@@ -6297,7 +6396,7 @@ msgstr "¿Qué volúmenes quieres eliminar?"
msgid "wire up healthchecks" msgid "wire up healthchecks"
msgstr "configurar chequeos de salud" msgstr "configurar chequeos de salud"
#: cli/recipe/release.go:106 #: cli/recipe/release.go:116
#, c-format #, c-format
msgid "working directory not clean in %s, aborting" msgid "working directory not clean in %s, aborting"
msgstr "el directorio de trabajo no está limpio en %s, abortando" msgstr "el directorio de trabajo no está limpio en %s, abortando"
@@ -6313,11 +6412,11 @@ msgstr ""
msgid "writing recipe version failed: %s" msgid "writing recipe version failed: %s"
msgstr "escritura de la versión de la receta fallida: %s" msgstr "escritura de la versión de la receta fallida: %s"
#: cli/recipe/release.go:654 cli/recipe/upgrade.go:376 #: cli/recipe/release.go:632 cli/recipe/upgrade.go:376
msgid "x" msgid "x"
msgstr "" msgstr ""
#: cli/recipe/release.go:662 cli/recipe/upgrade.go:384 #: cli/recipe/release.go:640 cli/recipe/upgrade.go:384
msgid "y" msgid "y"
msgstr "" msgstr ""
@@ -6325,11 +6424,11 @@ msgstr ""
msgid "you can only use one of: --major, --minor, --patch." msgid "you can only use one of: --major, --minor, --patch."
msgstr "solo puedes usar una de: --mayor, --menor, --parche." msgstr "solo puedes usar una de: --mayor, --menor, --parche."
#: cli/recipe/release.go:243 #: cli/recipe/release.go:248
msgid "you can only use one version flag: --major, --minor or --patch" msgid "you can only use one version flag: --major, --minor or --patch"
msgstr "solo puedes usar una opción de versión: --mayor, --menor o --parche" msgstr "solo puedes usar una opción de versión: --mayor, --menor o --parche"
#: cli/recipe/release.go:670 cli/recipe/upgrade.go:392 #: cli/recipe/release.go:648 cli/recipe/upgrade.go:392
msgid "z" msgid "z"
msgstr "" msgstr ""
@@ -6343,6 +6442,9 @@ msgstr ""
msgid "{name: %s, " msgid "{name: %s, "
msgstr "{nombre: %s, " msgstr "{nombre: %s, "
#~ msgid "removed freshly created commit"
#~ msgstr "eliminado commit recién creado"
#~ msgid "Sync recipe version label" #~ msgid "Sync recipe version label"
#~ msgstr "Sincronizar versión de la receta 🧑‍🍳" #~ msgstr "Sincronizar versión de la receta 🧑‍🍳"
+6 -4
View File
@@ -5,12 +5,15 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"coopcloud.tech/abra/pkg/test"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func TestIsDirty(t *testing.T) { func TestIsDirty(t *testing.T) {
r := Get("abra-test-recipe") test.Setup()
t.Cleanup(func() { test.Teardown() })
r := Get(test.RecipeName)
if err := r.EnsureExists(); err != nil { if err := r.EnsureExists(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -22,10 +25,9 @@ func TestIsDirty(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer f.Close() defer f.Close()
defer t.Cleanup(func() { t.Cleanup(func() { os.Remove(fpath) })
os.Remove(fpath)
})
dirty, err := r.IsDirty() dirty, err := r.IsDirty()
if err != nil { if err != nil {
+12 -11
View File
@@ -5,6 +5,7 @@ import (
"testing" "testing"
"coopcloud.tech/abra/pkg/config" "coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/test"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@@ -101,24 +102,24 @@ func TestGet(t *testing.T) {
} }
func TestGetVersionLabelLocalDoesNotUseTimeoutLabel(t *testing.T) { func TestGetVersionLabelLocalDoesNotUseTimeoutLabel(t *testing.T) {
r := Get("traefik") test.Setup()
t.Cleanup(func() { test.Teardown() })
r := Get(test.RecipeName)
if err := r.EnsureExists(); err != nil { if err := r.EnsureExists(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
for i := 1; i < 50; i++ { timeout := "120"
if err := test.AddEnv("TIMEOUT", timeout); err != nil {
t.Fatal(err)
}
for i := 1; i < 3; i++ {
label, err := r.GetVersionLabelLocal() label, err := r.GetVersionLabelLocal()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
assert.NotEqual(t, label, timeout)
// NOTE(d1): this is potentially quite a brittle unit test as it needs to
// hardcode the default timeout label to ensure that the label parser never
// returns it. hopefully this won't fail too often! if you're here because
// of a failure, just update the `defaultTimeoutLabel` value & permalink
// below
// https://git.coopcloud.tech/coop-cloud/traefik/src/commit/ac3a47fe8ca3ef92db84f64cfedfbb348000faee/.env.sample#L2
defaultTimeoutLabel := "300"
assert.NotEqual(t, label, defaultTimeoutLabel)
} }
} }
+54 -40
View File
@@ -2,57 +2,50 @@ package test
import ( import (
"fmt" "fmt"
"log"
"os" "os"
"path" "path"
appPkg "coopcloud.tech/abra/pkg/app" gitPkg "coopcloud.tech/abra/pkg/git"
"coopcloud.tech/abra/pkg/envfile" "git.coopcloud.tech/toolshed/godotenv"
"coopcloud.tech/abra/pkg/log"
"coopcloud.tech/abra/pkg/recipe"
) )
var ( var (
AppName = "test_app.example.com" AppName = "test_app.example.com"
ServerName = "test_server" ServerName = "test_server"
TFiles = []string{"bar.env", "foo.env"} RecipeName = "test_recipe"
TFolders = []string{"dir1", "dir2"}
TestServer = os.ExpandEnv("$PWD/../../tests/resources/test_server")
TestDir = os.ExpandEnv("$PWD/../../tests/resources/test_dir")
ExpectedAppEnv = envfile.AppEnv{ TFiles = []string{"bar.env", "foo.env"}
"DOMAIN": "test_app.example.com", TFolders = []string{"dir1", "dir2"}
"RECIPE": "test_recipe",
}
ExpectedApp = appPkg.App{ ServerDir = os.ExpandEnv("$ABRA_DIR/servers/test_server")
Name: AppName, RecipeDir = os.ExpandEnv("$ABRA_DIR/recipes/test_recipe")
Recipe: recipe.Get(ExpectedAppEnv["RECIPE"]), TestDir = os.ExpandEnv("$PWD/../../tests/resources/test_dir")
Domain: ExpectedAppEnv["DOMAIN"],
Env: ExpectedAppEnv,
Path: ExpectedAppFile.Path,
Server: ExpectedAppFile.Server,
}
ExpectedAppFile = appPkg.AppFile{ AppEnvPath = path.Join(ServerDir, fmt.Sprintf("%s.env", AppName))
Path: path.Join(TestServer, fmt.Sprintf("%s.env", AppName)),
Server: ServerName,
}
ExpectedAppFiles = map[string]appPkg.AppFile{ AbraTestRecipe = "abra-test-recipe"
AppName: ExpectedAppFile,
}
) )
func RmServerAppRecipe() { func Teardown() {
testAppLink := os.ExpandEnv("$ABRA_DIR/servers/test_server") abraDir := os.ExpandEnv("$ABRA_DIR")
os.Remove(testAppLink) if abraDir == fmt.Sprintf("%s/.abra", os.ExpandEnv("$HOME")) {
log.Fatal("set $ABRA_DIR before running the test suite")
}
testRecipeLink := os.ExpandEnv("$ABRA_DIR/recipes/test_recipe") if err := os.RemoveAll(abraDir); err != nil {
os.Remove(testRecipeLink) log.Fatal(err)
}
} }
func MkServerAppRecipe() { func Setup() {
RmServerAppRecipe() Teardown()
if err := os.Mkdir(os.ExpandEnv("$ABRA_DIR"), 0764); err != nil {
if !os.IsExist(err) {
log.Fatal(err)
}
}
if err := os.Mkdir(os.ExpandEnv("$ABRA_DIR/servers"), 0700); err != nil { if err := os.Mkdir(os.ExpandEnv("$ABRA_DIR/servers"), 0700); err != nil {
if !os.IsExist(err) { if !os.IsExist(err) {
@@ -66,15 +59,36 @@ func MkServerAppRecipe() {
} }
} }
testAppDir := os.ExpandEnv("$PWD/../../tests/resources/test_server") serverSrcDir := os.ExpandEnv("$PWD/../../tests/resources/test_server")
testAppLink := os.ExpandEnv("$ABRA_DIR/servers/test_server") serverDestDir := os.ExpandEnv("$ABRA_DIR/servers/test_server")
if err := os.Symlink(testAppDir, testAppLink); err != nil { if err := os.CopyFS(serverDestDir, os.DirFS(serverSrcDir)); err != nil {
log.Fatal(err) log.Fatal(err)
} }
testRecipeDir := os.ExpandEnv("$PWD/../../tests/resources/test_recipe") recipeSrcDir := os.ExpandEnv("$PWD/../../tests/resources/test_recipe")
testRecipeLink := os.ExpandEnv("$ABRA_DIR/recipes/test_recipe") recipeDestDir := os.ExpandEnv("$ABRA_DIR/recipes/test_recipe")
if err := os.Symlink(testRecipeDir, testRecipeLink); err != nil { if err := os.CopyFS(recipeDestDir, os.DirFS(recipeSrcDir)); err != nil {
log.Fatal(err)
}
if err := gitPkg.Init(recipeDestDir, true, "tester", "helo@coopcloud.tech"); err != nil {
log.Fatal(err) log.Fatal(err)
} }
} }
func AddEnv(envKey, envValue string) error {
filePath := os.ExpandEnv(fmt.Sprintf("$ABRA_DIR/servers/%s/%s.env", ServerName, AppName))
envVars, _, err := godotenv.Read(filePath)
if err != nil {
return err
}
envVars[envKey] = envValue
if err := godotenv.Write(envVars, filePath); err != nil {
return err
}
return nil
}
+1 -1
View File
@@ -138,7 +138,7 @@ func loadConfigFile(filename string) (*composetypes.ConfigFile, error) {
config, err := loader.ParseYAML(bytes) config, err := loader.ParseYAML(bytes)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("%s: %s", filename, err)
} }
return &composetypes.ConfigFile{ return &composetypes.ConfigFile{
+2 -2
View File
@@ -8,7 +8,7 @@
"gomodTidy" "gomodTidy"
], ],
"ignoreDeps": [ "ignoreDeps": [
"github.com/urfave/cli", "github.com/docker/cli",
"goreleaser/goreleaser" "github.com/spf13/cobra"
] ]
} }
+1 -1
View File
@@ -50,7 +50,7 @@ echo "========================================================================"
echo "========================================================================" echo "========================================================================"
echo "BUILDING ABRA" echo "BUILDING ABRA"
echo "========================================================================" echo "========================================================================"
export PATH="/usr/lib/go-1.21/bin:$PATH" export PATH="$PATH:/usr/local/go/bin"
make build make build
echo "========================================================================" echo "========================================================================"
+55 -8
View File
@@ -63,26 +63,23 @@ teardown() {
} }
@test "release minor bump" { @test "release minor bump" {
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --minor --commit
assert_success
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show
assert_success
assert_output --regexp 'image: nginx:1.2.*'
# NOTE(d1): ensure the latest tag is the one we expect # NOTE(d1): ensure the latest tag is the one we expect
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout 0.3.0+1.21.0
_remove_tags _remove_tags
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag \ run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag \
-a "0.3.0+1.21.0" -m "fake: 0.3.0+1.21.0" -a "0.3.0+1.21.0" -m "fake: 0.3.0+1.21.0"
assert_success assert_success
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --minor --commit
assert_success
run $ABRA recipe release "$TEST_RECIPE" --no-input --minor run $ABRA recipe release "$TEST_RECIPE" --no-input --minor
assert_success assert_success
assert_output --partial 'INFO new release published:' assert_output --partial 'INFO new release published:'
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag --list
assert_success assert_success
assert_output --regexp '0\.4\.0\+1\.2.*' assert_output --regexp '0\.4\.0\+1\.(.*)'
} }
@test "release with unstaged changes" { @test "release with unstaged changes" {
@@ -217,3 +214,53 @@ teardown() {
assert_failure assert_failure
assert_output --partial "automagic insertion not supported yet" assert_output --partial "automagic insertion not supported yet"
} }
@test "push during release fails" {
tagHash=$(_get_tag_hash "0.2.0+1.21.0")
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$tagHash"
assert_success
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --patch --commit
assert_success
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show
assert_success
assert_output --partial 'image: nginx:1.21.6'
wantHash="$(_get_current_hash)"
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" remote set-url origin-ssh "$ABRA_DIR/does/not/exist"
assert_success
run $ABRA recipe release "$TEST_RECIPE" --no-input --patch
assert_failure
assert_output --partial 'failed to publish new release:'
assert_output --partial 'any changes made have been reverted'
assert_equal "$wantHash" "$(_get_current_hash)"
assert_equal "$(_git_status)" ""
}
@test "release, fail, release: works" {
tagHash=$(_get_tag_hash "0.2.0+1.21.0")
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout "$tagHash"
assert_success
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --patch --commit
assert_success
# NOTE(d1): fake broken remote so the release fails
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" remote set-url origin-ssh "$ABRA_DIR/does/not/exist"
assert_success
run $ABRA recipe release "$TEST_RECIPE" --no-input --patch
assert_failure
# NOTE(d1): correct remote so release can proceed
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" remote set-url origin-ssh "$ABRA_DIR/origin-recipes/$TEST_RECIPE.git"
assert_success
run $ABRA recipe release "$TEST_RECIPE" --no-input --patch
assert_success
}
+6 -3
View File
@@ -1,6 +1,9 @@
RECIPE=test_recipe RECIPE=test_recipe
DOMAIN=test_app.example.com DOMAIN=test_app.example.com
# NOTE(d1): ensure commented out TIMEOUT doesn't get included #
# see TestReadEnv in ./pkg/envfile # NOTE(d1): for new changes, you *MUST* also update ../test_server/test_app.example.com.env
# TIMEOUT=120 #
# NOTE(d1): TestReadEnv
# FOO=BAR
+1
View File
@@ -8,6 +8,7 @@ services:
- proxy - proxy
deploy: deploy:
labels: labels:
- "coop-cloud.${STACK_NAME}.version=0.1.0+0.1.0"
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT}" - "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT}"
networks: networks:
@@ -1,6 +1,9 @@
RECIPE=test_recipe RECIPE=test_recipe
DOMAIN=test_app.example.com DOMAIN=test_app.example.com
# NOTE(d1): ensure commented out TIMEOUT doesn't get included #
# see TestReadEnv in ./pkg/envfile # NOTE(d1): for new changes, you *MUST* also update ../test_recipe/.env.sample
# TIMEOUT=120 #
# NOTE(d1): TestReadEnv
# FOO=BAR
+1 -1
View File
@@ -1,7 +1,7 @@
TOML stands for Tom's Obvious, Minimal Language. This Go package provides a TOML stands for Tom's Obvious, Minimal Language. This Go package provides a
reflection interface similar to Go's standard library `json` and `xml` packages. reflection interface similar to Go's standard library `json` and `xml` packages.
Compatible with TOML version [v1.0.0](https://toml.io/en/v1.0.0). Compatible with TOML version [v1.1.0](https://toml.io/en/v1.1.0).
Documentation: https://pkg.go.dev/github.com/BurntSushi/toml Documentation: https://pkg.go.dev/github.com/BurntSushi/toml
+8 -1
View File
@@ -206,6 +206,13 @@ func markDecodedRecursive(md *MetaData, tmap map[string]any) {
markDecodedRecursive(md, tmap) markDecodedRecursive(md, tmap)
md.context = md.context[0 : len(md.context)-1] md.context = md.context[0 : len(md.context)-1]
} }
if tarr, ok := tmap[key].([]map[string]any); ok {
for _, elm := range tarr {
md.context = append(md.context, key)
markDecodedRecursive(md, elm)
md.context = md.context[0 : len(md.context)-1]
}
}
} }
} }
@@ -423,7 +430,7 @@ func (md *MetaData) unifyString(data any, rv reflect.Value) error {
if i, ok := data.(int64); ok { if i, ok := data.(int64); ok {
rv.SetString(strconv.FormatInt(i, 10)) rv.SetString(strconv.FormatInt(i, 10))
} else if f, ok := data.(float64); ok { } else if f, ok := data.(float64); ok {
rv.SetString(strconv.FormatFloat(f, 'f', -1, 64)) rv.SetString(strconv.FormatFloat(f, 'g', -1, 64))
} else { } else {
return md.badtype("string", data) return md.badtype("string", data)
} }
+46 -33
View File
@@ -228,9 +228,9 @@ func (enc *Encoder) eElement(rv reflect.Value) {
} }
switch v.Location() { switch v.Location() {
default: default:
enc.wf(v.Format(format)) enc.write(v.Format(format))
case internal.LocalDatetime, internal.LocalDate, internal.LocalTime: case internal.LocalDatetime, internal.LocalDate, internal.LocalTime:
enc.wf(v.In(time.UTC).Format(format)) enc.write(v.In(time.UTC).Format(format))
} }
return return
case Marshaler: case Marshaler:
@@ -279,40 +279,40 @@ func (enc *Encoder) eElement(rv reflect.Value) {
case reflect.String: case reflect.String:
enc.writeQuoted(rv.String()) enc.writeQuoted(rv.String())
case reflect.Bool: case reflect.Bool:
enc.wf(strconv.FormatBool(rv.Bool())) enc.write(strconv.FormatBool(rv.Bool()))
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
enc.wf(strconv.FormatInt(rv.Int(), 10)) enc.write(strconv.FormatInt(rv.Int(), 10))
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
enc.wf(strconv.FormatUint(rv.Uint(), 10)) enc.write(strconv.FormatUint(rv.Uint(), 10))
case reflect.Float32: case reflect.Float32:
f := rv.Float() f := rv.Float()
if math.IsNaN(f) { if math.IsNaN(f) {
if math.Signbit(f) { if math.Signbit(f) {
enc.wf("-") enc.write("-")
} }
enc.wf("nan") enc.write("nan")
} else if math.IsInf(f, 0) { } else if math.IsInf(f, 0) {
if math.Signbit(f) { if math.Signbit(f) {
enc.wf("-") enc.write("-")
} }
enc.wf("inf") enc.write("inf")
} else { } else {
enc.wf(floatAddDecimal(strconv.FormatFloat(f, 'f', -1, 32))) enc.write(floatAddDecimal(strconv.FormatFloat(f, 'g', -1, 32)))
} }
case reflect.Float64: case reflect.Float64:
f := rv.Float() f := rv.Float()
if math.IsNaN(f) { if math.IsNaN(f) {
if math.Signbit(f) { if math.Signbit(f) {
enc.wf("-") enc.write("-")
} }
enc.wf("nan") enc.write("nan")
} else if math.IsInf(f, 0) { } else if math.IsInf(f, 0) {
if math.Signbit(f) { if math.Signbit(f) {
enc.wf("-") enc.write("-")
} }
enc.wf("inf") enc.write("inf")
} else { } else {
enc.wf(floatAddDecimal(strconv.FormatFloat(f, 'f', -1, 64))) enc.write(floatAddDecimal(strconv.FormatFloat(f, 'g', -1, 64)))
} }
case reflect.Array, reflect.Slice: case reflect.Array, reflect.Slice:
enc.eArrayOrSliceElement(rv) enc.eArrayOrSliceElement(rv)
@@ -330,27 +330,32 @@ func (enc *Encoder) eElement(rv reflect.Value) {
// By the TOML spec, all floats must have a decimal with at least one number on // By the TOML spec, all floats must have a decimal with at least one number on
// either side. // either side.
func floatAddDecimal(fstr string) string { func floatAddDecimal(fstr string) string {
if !strings.Contains(fstr, ".") { for _, c := range fstr {
return fstr + ".0" if c == 'e' { // Exponent syntax
return fstr
}
if c == '.' {
return fstr
}
} }
return fstr return fstr + ".0"
} }
func (enc *Encoder) writeQuoted(s string) { func (enc *Encoder) writeQuoted(s string) {
enc.wf("\"%s\"", dblQuotedReplacer.Replace(s)) enc.write(`"` + dblQuotedReplacer.Replace(s) + `"`)
} }
func (enc *Encoder) eArrayOrSliceElement(rv reflect.Value) { func (enc *Encoder) eArrayOrSliceElement(rv reflect.Value) {
length := rv.Len() length := rv.Len()
enc.wf("[") enc.write("[")
for i := 0; i < length; i++ { for i := 0; i < length; i++ {
elem := eindirect(rv.Index(i)) elem := eindirect(rv.Index(i))
enc.eElement(elem) enc.eElement(elem)
if i != length-1 { if i != length-1 {
enc.wf(", ") enc.write(", ")
} }
} }
enc.wf("]") enc.write("]")
} }
func (enc *Encoder) eArrayOfTables(key Key, rv reflect.Value) { func (enc *Encoder) eArrayOfTables(key Key, rv reflect.Value) {
@@ -363,7 +368,7 @@ func (enc *Encoder) eArrayOfTables(key Key, rv reflect.Value) {
continue continue
} }
enc.newline() enc.newline()
enc.wf("%s[[%s]]", enc.indentStr(key), key) enc.writef("%s[[%s]]", enc.indentStr(key), key)
enc.newline() enc.newline()
enc.eMapOrStruct(key, trv, false) enc.eMapOrStruct(key, trv, false)
} }
@@ -376,7 +381,7 @@ func (enc *Encoder) eTable(key Key, rv reflect.Value) {
enc.newline() enc.newline()
} }
if len(key) > 0 { if len(key) > 0 {
enc.wf("%s[%s]", enc.indentStr(key), key) enc.writef("%s[%s]", enc.indentStr(key), key)
enc.newline() enc.newline()
} }
enc.eMapOrStruct(key, rv, false) enc.eMapOrStruct(key, rv, false)
@@ -422,7 +427,7 @@ func (enc *Encoder) eMap(key Key, rv reflect.Value, inline bool) {
if inline { if inline {
enc.writeKeyValue(Key{mapKey.String()}, val, true) enc.writeKeyValue(Key{mapKey.String()}, val, true)
if trailC || i != len(mapKeys)-1 { if trailC || i != len(mapKeys)-1 {
enc.wf(", ") enc.write(", ")
} }
} else { } else {
enc.encode(key.add(mapKey.String()), val) enc.encode(key.add(mapKey.String()), val)
@@ -431,12 +436,12 @@ func (enc *Encoder) eMap(key Key, rv reflect.Value, inline bool) {
} }
if inline { if inline {
enc.wf("{") enc.write("{")
} }
writeMapKeys(mapKeysDirect, len(mapKeysSub) > 0) writeMapKeys(mapKeysDirect, len(mapKeysSub) > 0)
writeMapKeys(mapKeysSub, false) writeMapKeys(mapKeysSub, false)
if inline { if inline {
enc.wf("}") enc.write("}")
} }
} }
@@ -534,7 +539,7 @@ func (enc *Encoder) eStruct(key Key, rv reflect.Value, inline bool) {
if inline { if inline {
enc.writeKeyValue(Key{keyName}, fieldVal, true) enc.writeKeyValue(Key{keyName}, fieldVal, true)
if fieldIndex[0] != totalFields-1 { if fieldIndex[0] != totalFields-1 {
enc.wf(", ") enc.write(", ")
} }
} else { } else {
enc.encode(key.add(keyName), fieldVal) enc.encode(key.add(keyName), fieldVal)
@@ -543,14 +548,14 @@ func (enc *Encoder) eStruct(key Key, rv reflect.Value, inline bool) {
} }
if inline { if inline {
enc.wf("{") enc.write("{")
} }
l := len(fieldsDirect) + len(fieldsSub) l := len(fieldsDirect) + len(fieldsSub)
writeFields(fieldsDirect, l) writeFields(fieldsDirect, l)
writeFields(fieldsSub, l) writeFields(fieldsSub, l)
if inline { if inline {
enc.wf("}") enc.write("}")
} }
} }
@@ -700,7 +705,7 @@ func isEmpty(rv reflect.Value) bool {
func (enc *Encoder) newline() { func (enc *Encoder) newline() {
if enc.hasWritten { if enc.hasWritten {
enc.wf("\n") enc.write("\n")
} }
} }
@@ -722,14 +727,22 @@ func (enc *Encoder) writeKeyValue(key Key, val reflect.Value, inline bool) {
enc.eElement(val) enc.eElement(val)
return return
} }
enc.wf("%s%s = ", enc.indentStr(key), key.maybeQuoted(len(key)-1)) enc.writef("%s%s = ", enc.indentStr(key), key.maybeQuoted(len(key)-1))
enc.eElement(val) enc.eElement(val)
if !inline { if !inline {
enc.newline() enc.newline()
} }
} }
func (enc *Encoder) wf(format string, v ...any) { func (enc *Encoder) write(s string) {
_, err := enc.w.WriteString(s)
if err != nil {
encPanic(err)
}
enc.hasWritten = true
}
func (enc *Encoder) writef(format string, v ...any) {
_, err := fmt.Fprintf(enc.w, format, v...) _, err := fmt.Fprintf(enc.w, format, v...)
if err != nil { if err != nil {
encPanic(err) encPanic(err)
+53 -77
View File
@@ -13,7 +13,6 @@ type itemType int
const ( const (
itemError itemType = iota itemError itemType = iota
itemNIL // used in the parser to indicate no type
itemEOF itemEOF
itemText itemText
itemString itemString
@@ -47,14 +46,13 @@ func (p Position) String() string {
} }
type lexer struct { type lexer struct {
input string input string
start int start int
pos int pos int
line int line int
state stateFn state stateFn
items chan item items chan item
tomlNext bool esc bool
esc bool
// Allow for backing up up to 4 runes. This is necessary because TOML // Allow for backing up up to 4 runes. This is necessary because TOML
// contains 3-rune tokens (""" and '''). // contains 3-rune tokens (""" and ''').
@@ -90,14 +88,13 @@ func (lx *lexer) nextItem() item {
} }
} }
func lex(input string, tomlNext bool) *lexer { func lex(input string) *lexer {
lx := &lexer{ lx := &lexer{
input: input, input: input,
state: lexTop, state: lexTop,
items: make(chan item, 10), items: make(chan item, 10),
stack: make([]stateFn, 0, 10), stack: make([]stateFn, 0, 10),
line: 1, line: 1,
tomlNext: tomlNext,
} }
return lx return lx
} }
@@ -108,7 +105,7 @@ func (lx *lexer) push(state stateFn) {
func (lx *lexer) pop() stateFn { func (lx *lexer) pop() stateFn {
if len(lx.stack) == 0 { if len(lx.stack) == 0 {
return lx.errorf("BUG in lexer: no states to pop") panic("BUG in lexer: no states to pop")
} }
last := lx.stack[len(lx.stack)-1] last := lx.stack[len(lx.stack)-1]
lx.stack = lx.stack[0 : len(lx.stack)-1] lx.stack = lx.stack[0 : len(lx.stack)-1]
@@ -305,6 +302,8 @@ func lexTop(lx *lexer) stateFn {
return lexTableStart return lexTableStart
case eof: case eof:
if lx.pos > lx.start { if lx.pos > lx.start {
// TODO: never reached? I think this can only occur on a bug in the
// lexer(?)
return lx.errorf("unexpected EOF") return lx.errorf("unexpected EOF")
} }
lx.emit(itemEOF) lx.emit(itemEOF)
@@ -392,8 +391,6 @@ func lexTableNameStart(lx *lexer) stateFn {
func lexTableNameEnd(lx *lexer) stateFn { func lexTableNameEnd(lx *lexer) stateFn {
lx.skip(isWhitespace) lx.skip(isWhitespace)
switch r := lx.next(); { switch r := lx.next(); {
case isWhitespace(r):
return lexTableNameEnd
case r == '.': case r == '.':
lx.ignore() lx.ignore()
return lexTableNameStart return lexTableNameStart
@@ -412,7 +409,7 @@ func lexTableNameEnd(lx *lexer) stateFn {
// Lexes only one part, e.g. only 'a' inside 'a.b'. // Lexes only one part, e.g. only 'a' inside 'a.b'.
func lexBareName(lx *lexer) stateFn { func lexBareName(lx *lexer) stateFn {
r := lx.next() r := lx.next()
if isBareKeyChar(r, lx.tomlNext) { if isBareKeyChar(r) {
return lexBareName return lexBareName
} }
lx.backup() lx.backup()
@@ -420,23 +417,23 @@ func lexBareName(lx *lexer) stateFn {
return lx.pop() return lx.pop()
} }
// lexBareName lexes one part of a key or table. // lexQuotedName lexes one part of a quoted key or table name. It assumes that
// // it starts lexing at the quote itself (" or ').
// It assumes that at least one valid character for the table has already been
// read.
// //
// Lexes only one part, e.g. only '"a"' inside '"a".b'. // Lexes only one part, e.g. only '"a"' inside '"a".b'.
func lexQuotedName(lx *lexer) stateFn { func lexQuotedName(lx *lexer) stateFn {
r := lx.next() r := lx.next()
switch { switch {
case isWhitespace(r):
return lexSkip(lx, lexValue)
case r == '"': case r == '"':
lx.ignore() // ignore the '"' lx.ignore() // ignore the '"'
return lexString return lexString
case r == '\'': case r == '\'':
lx.ignore() // ignore the "'" lx.ignore() // ignore the "'"
return lexRawString return lexRawString
// TODO: I don't think any of the below conditions can ever be reached?
case isWhitespace(r):
return lexSkip(lx, lexValue)
case r == eof: case r == eof:
return lx.errorf("unexpected EOF; expected value") return lx.errorf("unexpected EOF; expected value")
default: default:
@@ -464,17 +461,19 @@ func lexKeyStart(lx *lexer) stateFn {
func lexKeyNameStart(lx *lexer) stateFn { func lexKeyNameStart(lx *lexer) stateFn {
lx.skip(isWhitespace) lx.skip(isWhitespace)
switch r := lx.peek(); { switch r := lx.peek(); {
case r == '=' || r == eof: default:
return lx.errorf("unexpected '='") lx.push(lexKeyEnd)
case r == '.': return lexBareName
return lx.errorf("unexpected '.'")
case r == '"' || r == '\'': case r == '"' || r == '\'':
lx.ignore() lx.ignore()
lx.push(lexKeyEnd) lx.push(lexKeyEnd)
return lexQuotedName return lexQuotedName
default:
lx.push(lexKeyEnd) // TODO: I think these can never be reached?
return lexBareName case r == '=' || r == eof:
return lx.errorf("unexpected '='")
case r == '.':
return lx.errorf("unexpected '.'")
} }
} }
@@ -485,7 +484,7 @@ func lexKeyEnd(lx *lexer) stateFn {
switch r := lx.next(); { switch r := lx.next(); {
case isWhitespace(r): case isWhitespace(r):
return lexSkip(lx, lexKeyEnd) return lexSkip(lx, lexKeyEnd)
case r == eof: case r == eof: // TODO: never reached
return lx.errorf("unexpected EOF; expected key separator '='") return lx.errorf("unexpected EOF; expected key separator '='")
case r == '.': case r == '.':
lx.ignore() lx.ignore()
@@ -628,10 +627,7 @@ func lexInlineTableValue(lx *lexer) stateFn {
case isWhitespace(r): case isWhitespace(r):
return lexSkip(lx, lexInlineTableValue) return lexSkip(lx, lexInlineTableValue)
case isNL(r): case isNL(r):
if lx.tomlNext { return lexSkip(lx, lexInlineTableValue)
return lexSkip(lx, lexInlineTableValue)
}
return lx.errorPrevLine(errLexInlineTableNL{})
case r == '#': case r == '#':
lx.push(lexInlineTableValue) lx.push(lexInlineTableValue)
return lexCommentStart return lexCommentStart
@@ -653,10 +649,7 @@ func lexInlineTableValueEnd(lx *lexer) stateFn {
case isWhitespace(r): case isWhitespace(r):
return lexSkip(lx, lexInlineTableValueEnd) return lexSkip(lx, lexInlineTableValueEnd)
case isNL(r): case isNL(r):
if lx.tomlNext { return lexSkip(lx, lexInlineTableValueEnd)
return lexSkip(lx, lexInlineTableValueEnd)
}
return lx.errorPrevLine(errLexInlineTableNL{})
case r == '#': case r == '#':
lx.push(lexInlineTableValueEnd) lx.push(lexInlineTableValueEnd)
return lexCommentStart return lexCommentStart
@@ -664,10 +657,7 @@ func lexInlineTableValueEnd(lx *lexer) stateFn {
lx.ignore() lx.ignore()
lx.skip(isWhitespace) lx.skip(isWhitespace)
if lx.peek() == '}' { if lx.peek() == '}' {
if lx.tomlNext { return lexInlineTableValueEnd
return lexInlineTableValueEnd
}
return lx.errorf("trailing comma not allowed in inline tables")
} }
return lexInlineTableValue return lexInlineTableValue
case r == '}': case r == '}':
@@ -855,9 +845,6 @@ func lexStringEscape(lx *lexer) stateFn {
r := lx.next() r := lx.next()
switch r { switch r {
case 'e': case 'e':
if !lx.tomlNext {
return lx.error(errLexEscape{r})
}
fallthrough fallthrough
case 'b': case 'b':
fallthrough fallthrough
@@ -878,9 +865,6 @@ func lexStringEscape(lx *lexer) stateFn {
case '\\': case '\\':
return lx.pop() return lx.pop()
case 'x': case 'x':
if !lx.tomlNext {
return lx.error(errLexEscape{r})
}
return lexHexEscape return lexHexEscape
case 'u': case 'u':
return lexShortUnicodeEscape return lexShortUnicodeEscape
@@ -928,19 +912,9 @@ func lexLongUnicodeEscape(lx *lexer) stateFn {
// lexBaseNumberOrDate can differentiate base prefixed integers from other // lexBaseNumberOrDate can differentiate base prefixed integers from other
// types. // types.
func lexNumberOrDateStart(lx *lexer) stateFn { func lexNumberOrDateStart(lx *lexer) stateFn {
r := lx.next() if lx.next() == '0' {
switch r {
case '0':
return lexBaseNumberOrDate return lexBaseNumberOrDate
} }
if !isDigit(r) {
// The only way to reach this state is if the value starts
// with a digit, so specifically treat anything else as an
// error.
return lx.errorf("expected a digit but got %q", r)
}
return lexNumberOrDate return lexNumberOrDate
} }
@@ -1196,13 +1170,13 @@ func lexSkip(lx *lexer, nextState stateFn) stateFn {
} }
func (s stateFn) String() string { func (s stateFn) String() string {
if s == nil {
return "<nil>"
}
name := runtime.FuncForPC(reflect.ValueOf(s).Pointer()).Name() name := runtime.FuncForPC(reflect.ValueOf(s).Pointer()).Name()
if i := strings.LastIndexByte(name, '.'); i > -1 { if i := strings.LastIndexByte(name, '.'); i > -1 {
name = name[i+1:] name = name[i+1:]
} }
if s == nil {
name = "<nil>"
}
return name + "()" return name + "()"
} }
@@ -1210,8 +1184,6 @@ func (itype itemType) String() string {
switch itype { switch itype {
case itemError: case itemError:
return "Error" return "Error"
case itemNIL:
return "NIL"
case itemEOF: case itemEOF:
return "EOF" return "EOF"
case itemText: case itemText:
@@ -1226,18 +1198,22 @@ func (itype itemType) String() string {
return "Float" return "Float"
case itemDatetime: case itemDatetime:
return "DateTime" return "DateTime"
case itemTableStart:
return "TableStart"
case itemTableEnd:
return "TableEnd"
case itemKeyStart:
return "KeyStart"
case itemKeyEnd:
return "KeyEnd"
case itemArray: case itemArray:
return "Array" return "Array"
case itemArrayEnd: case itemArrayEnd:
return "ArrayEnd" return "ArrayEnd"
case itemTableStart:
return "TableStart"
case itemTableEnd:
return "TableEnd"
case itemArrayTableStart:
return "ArrayTableStart"
case itemArrayTableEnd:
return "ArrayTableEnd"
case itemKeyStart:
return "KeyStart"
case itemKeyEnd:
return "KeyEnd"
case itemCommentStart: case itemCommentStart:
return "CommentStart" return "CommentStart"
case itemInlineTableStart: case itemInlineTableStart:
@@ -1266,7 +1242,7 @@ func isDigit(r rune) bool { return r >= '0' && r <= '9' }
func isBinary(r rune) bool { return r == '0' || r == '1' } func isBinary(r rune) bool { return r == '0' || r == '1' }
func isOctal(r rune) bool { return r >= '0' && r <= '7' } func isOctal(r rune) bool { return r >= '0' && r <= '7' }
func isHex(r rune) bool { return (r >= '0' && r <= '9') || (r|0x20 >= 'a' && r|0x20 <= 'f') } func isHex(r rune) bool { return (r >= '0' && r <= '9') || (r|0x20 >= 'a' && r|0x20 <= 'f') }
func isBareKeyChar(r rune, tomlNext bool) bool { func isBareKeyChar(r rune) bool {
return (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') || return (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') ||
(r >= '0' && r <= '9') || r == '_' || r == '-' (r >= '0' && r <= '9') || r == '_' || r == '-'
} }
+18 -28
View File
@@ -3,7 +3,6 @@ package toml
import ( import (
"fmt" "fmt"
"math" "math"
"os"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@@ -17,7 +16,6 @@ type parser struct {
context Key // Full key for the current hash in scope. context Key // Full key for the current hash in scope.
currentKey string // Base key name for everything except hashes. currentKey string // Base key name for everything except hashes.
pos Position // Current position in the TOML file. pos Position // Current position in the TOML file.
tomlNext bool
ordered []Key // List of keys in the order that they appear in the TOML data. ordered []Key // List of keys in the order that they appear in the TOML data.
@@ -32,8 +30,6 @@ type keyInfo struct {
} }
func parse(data string) (p *parser, err error) { func parse(data string) (p *parser, err error) {
_, tomlNext := os.LookupEnv("BURNTSUSHI_TOML_110")
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
if pErr, ok := r.(ParseError); ok { if pErr, ok := r.(ParseError); ok {
@@ -73,10 +69,9 @@ func parse(data string) (p *parser, err error) {
p = &parser{ p = &parser{
keyInfo: make(map[string]keyInfo), keyInfo: make(map[string]keyInfo),
mapping: make(map[string]any), mapping: make(map[string]any),
lx: lex(data, tomlNext), lx: lex(data),
ordered: make([]Key, 0), ordered: make([]Key, 0),
implicits: make(map[string]struct{}), implicits: make(map[string]struct{}),
tomlNext: tomlNext,
} }
for { for {
item := p.next() item := p.next()
@@ -350,17 +345,14 @@ func (p *parser) valueFloat(it item) (any, tomlType) {
var dtTypes = []struct { var dtTypes = []struct {
fmt string fmt string
zone *time.Location zone *time.Location
next bool
}{ }{
{time.RFC3339Nano, time.Local, false}, {time.RFC3339Nano, time.Local},
{"2006-01-02T15:04:05.999999999", internal.LocalDatetime, false}, {"2006-01-02T15:04:05.999999999", internal.LocalDatetime},
{"2006-01-02", internal.LocalDate, false}, {"2006-01-02", internal.LocalDate},
{"15:04:05.999999999", internal.LocalTime, false}, {"15:04:05.999999999", internal.LocalTime},
{"2006-01-02T15:04Z07:00", time.Local},
// tomlNext {"2006-01-02T15:04", internal.LocalDatetime},
{"2006-01-02T15:04Z07:00", time.Local, true}, {"15:04", internal.LocalTime},
{"2006-01-02T15:04", internal.LocalDatetime, true},
{"15:04", internal.LocalTime, true},
} }
func (p *parser) valueDatetime(it item) (any, tomlType) { func (p *parser) valueDatetime(it item) (any, tomlType) {
@@ -371,9 +363,6 @@ func (p *parser) valueDatetime(it item) (any, tomlType) {
err error err error
) )
for _, dt := range dtTypes { for _, dt := range dtTypes {
if dt.next && !p.tomlNext {
continue
}
t, err = time.ParseInLocation(dt.fmt, it.val, dt.zone) t, err = time.ParseInLocation(dt.fmt, it.val, dt.zone)
if err == nil { if err == nil {
if missingLeadingZero(it.val, dt.fmt) { if missingLeadingZero(it.val, dt.fmt) {
@@ -644,6 +633,11 @@ func (p *parser) setValue(key string, value any) {
// Note that since it has already been defined (as a hash), we don't // Note that since it has already been defined (as a hash), we don't
// want to overwrite it. So our business is done. // want to overwrite it. So our business is done.
if p.isArray(keyContext) { if p.isArray(keyContext) {
if !p.isImplicit(keyContext) {
if _, ok := hash[key]; ok {
p.panicf("Key '%s' has already been defined.", keyContext)
}
}
p.removeImplicit(keyContext) p.removeImplicit(keyContext)
hash[key] = value hash[key] = value
return return
@@ -802,10 +796,8 @@ func (p *parser) replaceEscapes(it item, str string) string {
b.WriteByte(0x0d) b.WriteByte(0x0d)
skip = 1 skip = 1
case 'e': case 'e':
if p.tomlNext { b.WriteByte(0x1b)
b.WriteByte(0x1b) skip = 1
skip = 1
}
case '"': case '"':
b.WriteByte(0x22) b.WriteByte(0x22)
skip = 1 skip = 1
@@ -815,11 +807,9 @@ func (p *parser) replaceEscapes(it item, str string) string {
// The lexer guarantees the correct number of characters are present; // The lexer guarantees the correct number of characters are present;
// don't need to check here. // don't need to check here.
case 'x': case 'x':
if p.tomlNext { escaped := p.asciiEscapeToUnicode(it, str[i+2:i+4])
escaped := p.asciiEscapeToUnicode(it, str[i+2:i+4]) b.WriteRune(escaped)
b.WriteRune(escaped) skip = 3
skip = 3
}
case 'u': case 'u':
escaped := p.asciiEscapeToUnicode(it, str[i+2:i+6]) escaped := p.asciiEscapeToUnicode(it, str[i+2:i+6])
b.WriteRune(escaped) b.WriteRune(escaped)
+2
View File
@@ -69,6 +69,8 @@ func (l *lineReader) Read(p []byte) (n int, err error) {
if isPrefix { if isPrefix {
return 0, ArmorCorrupt return 0, ArmorCorrupt
} }
// Trim the line to remove any whitespace
line = bytes.TrimSpace(line)
if bytes.HasPrefix(line, armorEnd) { if bytes.HasPrefix(line, armorEnd) {
l.eof = true l.eof = true
+8 -2
View File
@@ -125,7 +125,10 @@ func (c *curve25519) Encaps(rand io.Reader, point []byte) (ephemeral, sharedSecr
// "VB = convert point V to the octet string" // "VB = convert point V to the octet string"
// sharedPoint corresponds to `VB`. // sharedPoint corresponds to `VB`.
var sharedPoint x25519lib.Key var sharedPoint x25519lib.Key
x25519lib.Shared(&sharedPoint, &ephemeralPrivate, &pubKey) ok := x25519lib.Shared(&sharedPoint, &ephemeralPrivate, &pubKey)
if !ok {
return nil, nil, errors.KeyInvalidError("ecc: the public key is a low order point")
}
return ephemeralPublic[:], sharedPoint[:], nil return ephemeralPublic[:], sharedPoint[:], nil
} }
@@ -146,7 +149,10 @@ func (c *curve25519) Decaps(vsG, secret []byte) (sharedSecret []byte, err error)
// RFC6637 §8: "Note that the recipient obtains the shared secret by calculating // RFC6637 §8: "Note that the recipient obtains the shared secret by calculating
// S = rV = rvG, where (r,R) is the recipient's key pair." // S = rV = rvG, where (r,R) is the recipient's key pair."
// sharedPoint corresponds to `S`. // sharedPoint corresponds to `S`.
x25519lib.Shared(&sharedPoint, &decodedPrivate, &ephemeralPublic) ok := x25519lib.Shared(&sharedPoint, &decodedPrivate, &ephemeralPublic)
if !ok {
return nil, errors.KeyInvalidError("ecc: the public key is a low order point")
}
return sharedPoint[:], nil return sharedPoint[:], nil
} }
+4 -1
View File
@@ -78,7 +78,7 @@ func (c *genericCurve) GenerateECDSA(rand io.Reader) (x, y, secret *big.Int, err
func (c *genericCurve) Encaps(rand io.Reader, point []byte) (ephemeral, sharedSecret []byte, err error) { func (c *genericCurve) Encaps(rand io.Reader, point []byte) (ephemeral, sharedSecret []byte, err error) {
xP, yP := elliptic.Unmarshal(c.Curve, point) xP, yP := elliptic.Unmarshal(c.Curve, point)
if xP == nil { if xP == nil {
panic("invalid point") return nil, nil, errors.KeyInvalidError(fmt.Sprintf("ecc (%s): invalid point", c.Curve.Params().Name))
} }
d, x, y, err := elliptic.GenerateKey(c.Curve, rand) d, x, y, err := elliptic.GenerateKey(c.Curve, rand)
@@ -99,6 +99,9 @@ func (c *genericCurve) Encaps(rand io.Reader, point []byte) (ephemeral, sharedSe
func (c *genericCurve) Decaps(ephemeral, secret []byte) (sharedSecret []byte, err error) { func (c *genericCurve) Decaps(ephemeral, secret []byte) (sharedSecret []byte, err error) {
x, y := elliptic.Unmarshal(c.Curve, ephemeral) x, y := elliptic.Unmarshal(c.Curve, ephemeral)
if x == nil {
return nil, errors.KeyInvalidError(fmt.Sprintf("ecc (%s): invalid point", c.Curve.Params().Name))
}
zbBig, _ := c.Curve.ScalarMult(x, y, secret) zbBig, _ := c.Curve.ScalarMult(x, y, secret)
byteLen := (c.Curve.Params().BitSize + 7) >> 3 byteLen := (c.Curve.Params().BitSize + 7) >> 3
zb := make([]byte, byteLen) zb := make([]byte, byteLen)
+26
View File
@@ -178,6 +178,18 @@ type Config struct {
// When set to true, a key without flags is treated as if all flags are enabled. // When set to true, a key without flags is treated as if all flags are enabled.
// This behavior is consistent with GPG. // This behavior is consistent with GPG.
InsecureAllowAllKeyFlagsWhenMissing bool InsecureAllowAllKeyFlagsWhenMissing bool
// InsecureGenerateNonCriticalKeyFlags causes the "Key Flags" signature subpacket
// to be non-critical in newly generated signatures.
// This may be needed for keys to be accepted by older clients who do not recognize
// the subpacket.
// For example, rpm 4.14.3-150400.59.3.1 in OpenSUSE Leap 15.4 does not recognize it.
InsecureGenerateNonCriticalKeyFlags bool
// InsecureGenerateNonCriticalSignatureCreationTime causes the "Signature Creation Time" signature subpacket
// to be non-critical in newly generated signatures.
// This may be needed for keys to be accepted by older clients who do not recognize
// the subpacket.
// For example, yum 3.4.3-168 in CentOS 7 and yum 3.4.3-158 in Amazon Linux 2 do not recognize it.
InsecureGenerateNonCriticalSignatureCreationTime bool
// MaxDecompressedMessageSize specifies the maximum number of bytes that can be // MaxDecompressedMessageSize specifies the maximum number of bytes that can be
// read from a compressed packet. This serves as an upper limit to prevent // read from a compressed packet. This serves as an upper limit to prevent
@@ -420,6 +432,20 @@ func (c *Config) AllowAllKeyFlagsWhenMissing() bool {
return c.InsecureAllowAllKeyFlagsWhenMissing return c.InsecureAllowAllKeyFlagsWhenMissing
} }
func (c *Config) GenerateNonCriticalKeyFlags() bool {
if c == nil {
return false
}
return c.InsecureGenerateNonCriticalKeyFlags
}
func (c *Config) GenerateNonCriticalSignatureCreationTime() bool {
if c == nil {
return false
}
return c.InsecureGenerateNonCriticalSignatureCreationTime
}
func (c *Config) DecompressedMessageSizeLimit() *int64 { func (c *Config) DecompressedMessageSizeLimit() *int64 {
if c == nil { if c == nil {
return nil return nil
+4 -4
View File
@@ -933,7 +933,7 @@ func (sig *Signature) Sign(h hash.Hash, priv *PrivateKey, config *Config) (err e
} }
sig.Notations = append(sig.Notations, &notation) sig.Notations = append(sig.Notations, &notation)
} }
sig.outSubpackets, err = sig.buildSubpackets(priv.PublicKey) sig.outSubpackets, err = sig.buildSubpackets(priv.PublicKey, config)
if err != nil { if err != nil {
return err return err
} }
@@ -1254,11 +1254,11 @@ type outputSubpacket struct {
contents []byte contents []byte
} }
func (sig *Signature) buildSubpackets(issuer PublicKey) (subpackets []outputSubpacket, err error) { func (sig *Signature) buildSubpackets(issuer PublicKey, config *Config) (subpackets []outputSubpacket, err error) {
creationTime := make([]byte, 4) creationTime := make([]byte, 4)
binary.BigEndian.PutUint32(creationTime, uint32(sig.CreationTime.Unix())) binary.BigEndian.PutUint32(creationTime, uint32(sig.CreationTime.Unix()))
// Signature Creation Time // Signature Creation Time
subpackets = append(subpackets, outputSubpacket{true, creationTimeSubpacket, true, creationTime}) subpackets = append(subpackets, outputSubpacket{true, creationTimeSubpacket, !config.GenerateNonCriticalSignatureCreationTime(), creationTime})
// Signature Expiration Time // Signature Expiration Time
if sig.SigLifetimeSecs != nil && *sig.SigLifetimeSecs != 0 { if sig.SigLifetimeSecs != nil && *sig.SigLifetimeSecs != 0 {
sigLifetime := make([]byte, 4) sigLifetime := make([]byte, 4)
@@ -1357,7 +1357,7 @@ func (sig *Signature) buildSubpackets(issuer PublicKey) (subpackets []outputSubp
if sig.FlagGroupKey { if sig.FlagGroupKey {
flags |= KeyFlagGroupKey flags |= KeyFlagGroupKey
} }
subpackets = append(subpackets, outputSubpacket{true, keyFlagsSubpacket, true, []byte{flags}}) subpackets = append(subpackets, outputSubpacket{true, keyFlagsSubpacket, !config.GenerateNonCriticalKeyFlags(), []byte{flags}})
} }
// Signer's User ID // Signer's User ID
if sig.SignerUserId != nil { if sig.SignerUserId != nil {
+3
View File
@@ -33,6 +33,9 @@ linters:
generated: lax generated: lax
presets: presets:
- common-false-positives - common-false-positives
settings:
exhaustive:
default-signifies-exhaustive: true
issues: issues:
max-issues-per-linter: 0 max-issues-per-linter: 0
max-same-issues: 0 max-same-issues: 0
+24 -23
View File
@@ -2,6 +2,7 @@ package colorprofile
import ( import (
"bytes" "bytes"
"context"
"io" "io"
"os/exec" "os/exec"
"runtime" "runtime"
@@ -83,8 +84,8 @@ func colorProfile(isatty bool, env environ) (p Profile) {
} }
if envNoColor(env) && isatty { if envNoColor(env) && isatty {
if p > Ascii { if p > ASCII {
p = Ascii p = ASCII
} }
return //nolint:nakedret return //nolint:nakedret
} }
@@ -153,29 +154,29 @@ func envColorProfile(env environ) (p Profile) {
p = ANSI p = ANSI
} }
parts := strings.Split(term, "-") switch {
switch parts[0] { case strings.Contains(term, "alacritty"),
case "alacritty", strings.Contains(term, "contour"),
"contour", strings.Contains(term, "foot"),
"foot", strings.Contains(term, "ghostty"),
"ghostty", strings.Contains(term, "kitty"),
"kitty", strings.Contains(term, "rio"),
"rio", strings.Contains(term, "st"),
"st", strings.Contains(term, "wezterm"):
"wezterm":
return TrueColor return TrueColor
case "xterm": case strings.HasPrefix(term, "tmux"), strings.HasPrefix(term, "screen"):
if len(parts) > 1 {
switch parts[1] {
case "ghostty", "kitty":
// These terminals can be defined as xterm-TERMNAME
return TrueColor
}
}
case "tmux", "screen":
if p < ANSI256 { if p < ANSI256 {
p = ANSI256 p = ANSI256
} }
case strings.HasPrefix(term, "xterm"):
if p < ANSI {
p = ANSI
}
}
if len(env["WT_SESSION"]) > 0 {
// Windows Terminal supports TrueColor
return TrueColor
} }
if isCloudShell, _ := strconv.ParseBool(env.get("GOOGLE_CLOUD_SHELL")); isCloudShell { if isCloudShell, _ := strconv.ParseBool(env.get("GOOGLE_CLOUD_SHELL")); isCloudShell {
@@ -244,13 +245,13 @@ func tmux(env environ) (p Profile) {
// Check if tmux has either Tc or RGB capabilities. Otherwise, return // Check if tmux has either Tc or RGB capabilities. Otherwise, return
// ANSI256. // ANSI256.
p = ANSI256 p = ANSI256
cmd := exec.Command("tmux", "info") cmd := exec.CommandContext(context.Background(), "tmux", "info")
out, err := cmd.Output() out, err := cmd.Output()
if err != nil { if err != nil {
return return
} }
for _, line := range bytes.Split(out, []byte("\n")) { for line := range bytes.SplitSeq(out, []byte("\n")) {
if (bytes.Contains(line, []byte("Tc")) || bytes.Contains(line, []byte("RGB"))) && if (bytes.Contains(line, []byte("Tc")) || bytes.Contains(line, []byte("RGB"))) &&
bytes.Contains(line, []byte("true")) { bytes.Contains(line, []byte("true")) {
return TrueColor return TrueColor
-5
View File
@@ -14,11 +14,6 @@ func windowsColorProfile(env map[string]string) (Profile, bool) {
return TrueColor, true return TrueColor, true
} }
if len(env["WT_SESSION"]) > 0 {
// Windows Terminal supports TrueColor
return TrueColor, true
}
major, _, build := windows.RtlGetNtVersionNumbers() major, _, build := windows.RtlGetNtVersionNumbers()
if build < 10586 || major < 10 { if build < 10586 || major < 10 {
// No ANSI support before WindowsNT 10 build 10586 // No ANSI support before WindowsNT 10 build 10586
+17 -9
View File
@@ -11,10 +11,12 @@ import (
type Profile byte type Profile byte
const ( const (
// Unknown is a profile that represents the absence of a profile.
Unknown Profile = iota
// NoTTY is a profile with no terminal support. // NoTTY is a profile with no terminal support.
NoTTY Profile = iota NoTTY
// Ascii is a profile with no color support. // ASCII is a profile with no color support.
Ascii //nolint:revive ASCII
// ANSI is a profile with 16 colors (4-bit). // ANSI is a profile with 16 colors (4-bit).
ANSI ANSI
// ANSI256 is a profile with 256 colors (8-bit). // ANSI256 is a profile with 256 colors (8-bit).
@@ -23,6 +25,9 @@ const (
TrueColor TrueColor
) )
// Ascii is an alias for the [ASCII] profile for backwards compatibility.
const Ascii = ASCII //nolint:revive
// String returns the string representation of a Profile. // String returns the string representation of a Profile.
func (p Profile) String() string { func (p Profile) String() string {
switch p { switch p {
@@ -32,12 +37,13 @@ func (p Profile) String() string {
return "ANSI256" return "ANSI256"
case ANSI: case ANSI:
return "ANSI" return "ANSI"
case Ascii: case ASCII:
return "Ascii" return "Ascii"
case NoTTY: case NoTTY:
return "NoTTY" return "NoTTY"
default:
return "Unknown"
} }
return "Unknown"
} }
var ( var (
@@ -50,7 +56,7 @@ var (
// Convert transforms a given Color to a Color supported within the Profile. // Convert transforms a given Color to a Color supported within the Profile.
func (p Profile) Convert(c color.Color) (cc color.Color) { func (p Profile) Convert(c color.Color) (cc color.Color) {
if p <= Ascii { if p <= ASCII {
return nil return nil
} }
if p == TrueColor { if p == TrueColor {
@@ -90,11 +96,13 @@ func (p Profile) Convert(c color.Color) (cc color.Color) {
return c return c
default: default:
if p == ANSI256 { switch p {
case ANSI256:
return ansi.Convert256(c) return ansi.Convert256(c)
} else if p == ANSI { case ANSI:
return ansi.Convert16(c) return ansi.Convert16(c)
default:
return c
} }
return c
} }
} }
+11 -9
View File
@@ -36,13 +36,15 @@ type Writer struct {
// Write writes the given text to the underlying writer. // Write writes the given text to the underlying writer.
func (w *Writer) Write(p []byte) (int, error) { func (w *Writer) Write(p []byte) (int, error) {
switch w.Profile { switch {
case TrueColor: case w.Profile == TrueColor:
return w.Forward.Write(p) //nolint:wrapcheck return w.Forward.Write(p) //nolint:wrapcheck
case NoTTY: case w.Profile <= NoTTY:
return io.WriteString(w.Forward, ansi.Strip(string(p))) //nolint:wrapcheck _, err := io.WriteString(w.Forward, ansi.Strip(string(p)))
case Ascii, ANSI, ANSI256: return len(p), err
return w.downsample(p) case w.Profile == ASCII, w.Profile == ANSI, w.Profile == ANSI256:
_, err := w.downsample(p)
return len(p), err
default: default:
return 0, fmt.Errorf("invalid profile: %v", w.Profile) return 0, fmt.Errorf("invalid profile: %v", w.Profile)
} }
@@ -112,7 +114,7 @@ func handleSgr(w *Writer, p *ansi.Parser, buf *bytes.Buffer) {
if w.Profile < ANSI { if w.Profile < ANSI {
continue continue
} }
style = style.DefaultForegroundColor() style = style.ForegroundColor(nil)
case 40, 41, 42, 43, 44, 45, 46, 47: // 8-bit background color case 40, 41, 42, 43, 44, 45, 46, 47: // 8-bit background color
if w.Profile < ANSI { if w.Profile < ANSI {
continue continue
@@ -132,7 +134,7 @@ func handleSgr(w *Writer, p *ansi.Parser, buf *bytes.Buffer) {
if w.Profile < ANSI { if w.Profile < ANSI {
continue continue
} }
style = style.DefaultBackgroundColor() style = style.BackgroundColor(nil)
case 58: // 16 or 24-bit underline color case 58: // 16 or 24-bit underline color
var c color.Color var c color.Color
if n := ansi.ReadStyleColor(params[i:], &c); n > 0 { if n := ansi.ReadStyleColor(params[i:], &c); n > 0 {
@@ -146,7 +148,7 @@ func handleSgr(w *Writer, p *ansi.Parser, buf *bytes.Buffer) {
if w.Profile < ANSI { if w.Profile < ANSI {
continue continue
} }
style = style.DefaultUnderlineColor() style = style.UnderlineColor(nil)
case 90, 91, 92, 93, 94, 95, 96, 97: // 8-bit bright foreground color case 90, 91, 92, 93, 94, 95, 96, 97: // 8-bit bright foreground color
if w.Profile < ANSI { if w.Profile < ANSI {
continue continue
+7 -1
View File
@@ -7,7 +7,6 @@ linters:
- exhaustive - exhaustive
- goconst - goconst
- godot - godot
- godox
- gomoddirectives - gomoddirectives
- goprintffuncname - goprintffuncname
- gosec - gosec
@@ -27,9 +26,16 @@ linters:
- whitespace - whitespace
- wrapcheck - wrapcheck
exclusions: exclusions:
rules:
- text: '(slog|log)\.\w+'
linters:
- noctx
generated: lax generated: lax
presets: presets:
- common-false-positives - common-false-positives
settings:
exhaustive:
default-signifies-exhaustive: true
issues: issues:
max-issues-per-linter: 0 max-issues-per-linter: 0
max-same-issues: 0 max-same-issues: 0
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"time" "time"
) )
func (l *Logger) jsonFormatter(keyvals ...interface{}) { func (l *Logger) jsonFormatter(keyvals ...any) {
jw := &jsonWriter{w: &l.b} jw := &jsonWriter{w: &l.b}
jw.start() jw.start()
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"github.com/go-logfmt/logfmt" "github.com/go-logfmt/logfmt"
) )
func (l *Logger) logfmtFormatter(keyvals ...interface{}) { func (l *Logger) logfmtFormatter(keyvals ...any) {
e := logfmt.NewEncoder(&l.b) e := logfmt.NewEncoder(&l.b)
for i := 0; i < len(keyvals); i += 2 { for i := 0; i < len(keyvals); i += 2 {
+19 -19
View File
@@ -41,19 +41,19 @@ type Logger struct {
reportCaller bool reportCaller bool
reportTimestamp bool reportTimestamp bool
fields []interface{} fields []any
helpers *sync.Map helpers *sync.Map
styles *Styles styles *Styles
} }
// Logf logs a message with formatting. // Logf logs a message with formatting.
func (l *Logger) Logf(level Level, format string, args ...interface{}) { func (l *Logger) Logf(level Level, format string, args ...any) {
l.Log(level, fmt.Sprintf(format, args...)) l.Log(level, fmt.Sprintf(format, args...))
} }
// Log logs the given message with the given keyvals for the given level. // Log logs the given message with the given keyvals for the given level.
func (l *Logger) Log(level Level, msg interface{}, keyvals ...interface{}) { func (l *Logger) Log(level Level, msg any, keyvals ...any) {
if atomic.LoadUint32(&l.isDiscard) != 0 { if atomic.LoadUint32(&l.isDiscard) != 0 {
return return
} }
@@ -81,8 +81,8 @@ func (l *Logger) Log(level Level, msg interface{}, keyvals ...interface{}) {
l.handle(level, l.timeFunc(time.Now()), []runtime.Frame{frame}, msg, keyvals...) l.handle(level, l.timeFunc(time.Now()), []runtime.Frame{frame}, msg, keyvals...)
} }
func (l *Logger) handle(level Level, ts time.Time, frames []runtime.Frame, msg interface{}, keyvals ...interface{}) { func (l *Logger) handle(level Level, ts time.Time, frames []runtime.Frame, msg any, keyvals ...any) {
var kvs []interface{} var kvs []any
if l.reportTimestamp && !ts.IsZero() { if l.reportTimestamp && !ts.IsZero() {
kvs = append(kvs, TimestampKey, ts) kvs = append(kvs, TimestampKey, ts)
} }
@@ -327,7 +327,7 @@ func (l *Logger) SetStyles(s *Styles) {
} }
// With returns a new logger with the given keyvals added. // With returns a new logger with the given keyvals added.
func (l *Logger) With(keyvals ...interface{}) *Logger { func (l *Logger) With(keyvals ...any) *Logger {
var st Styles var st Styles
l.mu.Lock() l.mu.Lock()
sl := *l sl := *l
@@ -336,7 +336,7 @@ func (l *Logger) With(keyvals ...interface{}) *Logger {
sl.b = bytes.Buffer{} sl.b = bytes.Buffer{}
sl.mu = &sync.RWMutex{} sl.mu = &sync.RWMutex{}
sl.helpers = &sync.Map{} sl.helpers = &sync.Map{}
sl.fields = append(make([]interface{}, 0, len(l.fields)+len(keyvals)), l.fields...) sl.fields = append(make([]any, 0, len(l.fields)+len(keyvals)), l.fields...)
sl.fields = append(sl.fields, keyvals...) sl.fields = append(sl.fields, keyvals...)
sl.styles = &st sl.styles = &st
return &sl return &sl
@@ -350,63 +350,63 @@ func (l *Logger) WithPrefix(prefix string) *Logger {
} }
// Debug prints a debug message. // Debug prints a debug message.
func (l *Logger) Debug(msg interface{}, keyvals ...interface{}) { func (l *Logger) Debug(msg any, keyvals ...any) {
l.Log(DebugLevel, msg, keyvals...) l.Log(DebugLevel, msg, keyvals...)
} }
// Info prints an info message. // Info prints an info message.
func (l *Logger) Info(msg interface{}, keyvals ...interface{}) { func (l *Logger) Info(msg any, keyvals ...any) {
l.Log(InfoLevel, msg, keyvals...) l.Log(InfoLevel, msg, keyvals...)
} }
// Warn prints a warning message. // Warn prints a warning message.
func (l *Logger) Warn(msg interface{}, keyvals ...interface{}) { func (l *Logger) Warn(msg any, keyvals ...any) {
l.Log(WarnLevel, msg, keyvals...) l.Log(WarnLevel, msg, keyvals...)
} }
// Error prints an error message. // Error prints an error message.
func (l *Logger) Error(msg interface{}, keyvals ...interface{}) { func (l *Logger) Error(msg any, keyvals ...any) {
l.Log(ErrorLevel, msg, keyvals...) l.Log(ErrorLevel, msg, keyvals...)
} }
// Fatal prints a fatal message and exits. // Fatal prints a fatal message and exits.
func (l *Logger) Fatal(msg interface{}, keyvals ...interface{}) { func (l *Logger) Fatal(msg any, keyvals ...any) {
l.Log(FatalLevel, msg, keyvals...) l.Log(FatalLevel, msg, keyvals...)
os.Exit(1) os.Exit(1)
} }
// Print prints a message with no level. // Print prints a message with no level.
func (l *Logger) Print(msg interface{}, keyvals ...interface{}) { func (l *Logger) Print(msg any, keyvals ...any) {
l.Log(noLevel, msg, keyvals...) l.Log(noLevel, msg, keyvals...)
} }
// Debugf prints a debug message with formatting. // Debugf prints a debug message with formatting.
func (l *Logger) Debugf(format string, args ...interface{}) { func (l *Logger) Debugf(format string, args ...any) {
l.Log(DebugLevel, fmt.Sprintf(format, args...)) l.Log(DebugLevel, fmt.Sprintf(format, args...))
} }
// Infof prints an info message with formatting. // Infof prints an info message with formatting.
func (l *Logger) Infof(format string, args ...interface{}) { func (l *Logger) Infof(format string, args ...any) {
l.Log(InfoLevel, fmt.Sprintf(format, args...)) l.Log(InfoLevel, fmt.Sprintf(format, args...))
} }
// Warnf prints a warning message with formatting. // Warnf prints a warning message with formatting.
func (l *Logger) Warnf(format string, args ...interface{}) { func (l *Logger) Warnf(format string, args ...any) {
l.Log(WarnLevel, fmt.Sprintf(format, args...)) l.Log(WarnLevel, fmt.Sprintf(format, args...))
} }
// Errorf prints an error message with formatting. // Errorf prints an error message with formatting.
func (l *Logger) Errorf(format string, args ...interface{}) { func (l *Logger) Errorf(format string, args ...any) {
l.Log(ErrorLevel, fmt.Sprintf(format, args...)) l.Log(ErrorLevel, fmt.Sprintf(format, args...))
} }
// Fatalf prints a fatal message with formatting and exits. // Fatalf prints a fatal message with formatting and exits.
func (l *Logger) Fatalf(format string, args ...interface{}) { func (l *Logger) Fatalf(format string, args ...any) {
l.Log(FatalLevel, fmt.Sprintf(format, args...)) l.Log(FatalLevel, fmt.Sprintf(format, args...))
os.Exit(1) os.Exit(1)
} }
// Printf prints a message with no level and formatting. // Printf prints a message with no level and formatting.
func (l *Logger) Printf(format string, args ...interface{}) { func (l *Logger) Printf(format string, args ...any) {
l.Log(noLevel, fmt.Sprintf(format, args...)) l.Log(noLevel, fmt.Sprintf(format, args...))
} }
+2 -2
View File
@@ -36,7 +36,7 @@ func (l *Logger) Handle(ctx context.Context, record slog.Record) error {
return nil return nil
} }
fields := make([]interface{}, 0, record.NumAttrs()*2) fields := make([]any, 0, record.NumAttrs()*2)
record.Attrs(func(a slog.Attr) bool { record.Attrs(func(a slog.Attr) bool {
fields = append(fields, a.Key, a.Value) fields = append(fields, a.Key, a.Value)
return true return true
@@ -52,7 +52,7 @@ func (l *Logger) Handle(ctx context.Context, record slog.Record) error {
// //
// Implements slog.Handler. // Implements slog.Handler.
func (l *Logger) WithAttrs(attrs []slog.Attr) slog.Handler { func (l *Logger) WithAttrs(attrs []slog.Attr) slog.Handler {
fields := make([]interface{}, 0, len(attrs)*2) fields := make([]any, 0, len(attrs)*2)
for _, attr := range attrs { for _, attr := range attrs {
fields = append(fields, attr.Key, attr.Value) fields = append(fields, attr.Key, attr.Value)
} }
+2 -2
View File
@@ -33,7 +33,7 @@ func (l *Logger) Enabled(_ context.Context, level slog.Level) bool {
// //
// Implements slog.Handler. // Implements slog.Handler.
func (l *Logger) Handle(_ context.Context, record slog.Record) error { func (l *Logger) Handle(_ context.Context, record slog.Record) error {
fields := make([]interface{}, 0, record.NumAttrs()*2) fields := make([]any, 0, record.NumAttrs()*2)
record.Attrs(func(a slog.Attr) bool { record.Attrs(func(a slog.Attr) bool {
fields = append(fields, a.Key, a.Value) fields = append(fields, a.Key, a.Value)
return true return true
@@ -49,7 +49,7 @@ func (l *Logger) Handle(_ context.Context, record slog.Record) error {
// //
// Implements slog.Handler. // Implements slog.Handler.
func (l *Logger) WithAttrs(attrs []slog.Attr) slog.Handler { func (l *Logger) WithAttrs(attrs []slog.Attr) slog.Handler {
fields := make([]interface{}, 0, len(attrs)*2) fields := make([]any, 0, len(attrs)*2)
for _, attr := range attrs { for _, attr := range attrs {
fields = append(fields, attr.Key, attr.Value) fields = append(fields, attr.Key, attr.Value)
} }
+1 -1
View File
@@ -55,7 +55,7 @@ type Options struct {
// CallerOffset is the caller format for the logger. The default is 0. // CallerOffset is the caller format for the logger. The default is 0.
CallerOffset int CallerOffset int
// Fields is the fields for the logger. The default is no fields. // Fields is the fields for the logger. The default is no fields.
Fields []interface{} Fields []any
// Formatter is the formatter for the logger. The default is TextFormatter. // Formatter is the formatter for the logger. The default is TextFormatter.
Formatter Formatter Formatter Formatter
} }
+15 -15
View File
@@ -155,7 +155,7 @@ func GetPrefix() string {
} }
// With returns a new logger with the given keyvals. // With returns a new logger with the given keyvals.
func With(keyvals ...interface{}) *Logger { func With(keyvals ...any) *Logger {
return Default().With(keyvals...) return Default().With(keyvals...)
} }
@@ -172,74 +172,74 @@ func Helper() {
} }
// Log logs a message with the given level. // Log logs a message with the given level.
func Log(level Level, msg interface{}, keyvals ...interface{}) { func Log(level Level, msg any, keyvals ...any) {
Default().Log(level, msg, keyvals...) Default().Log(level, msg, keyvals...)
} }
// Debug logs a debug message. // Debug logs a debug message.
func Debug(msg interface{}, keyvals ...interface{}) { func Debug(msg any, keyvals ...any) {
Default().Log(DebugLevel, msg, keyvals...) Default().Log(DebugLevel, msg, keyvals...)
} }
// Info logs an info message. // Info logs an info message.
func Info(msg interface{}, keyvals ...interface{}) { func Info(msg any, keyvals ...any) {
Default().Log(InfoLevel, msg, keyvals...) Default().Log(InfoLevel, msg, keyvals...)
} }
// Warn logs a warning message. // Warn logs a warning message.
func Warn(msg interface{}, keyvals ...interface{}) { func Warn(msg any, keyvals ...any) {
Default().Log(WarnLevel, msg, keyvals...) Default().Log(WarnLevel, msg, keyvals...)
} }
// Error logs an error message. // Error logs an error message.
func Error(msg interface{}, keyvals ...interface{}) { func Error(msg any, keyvals ...any) {
Default().Log(ErrorLevel, msg, keyvals...) Default().Log(ErrorLevel, msg, keyvals...)
} }
// Fatal logs a fatal message and exit. // Fatal logs a fatal message and exit.
func Fatal(msg interface{}, keyvals ...interface{}) { func Fatal(msg any, keyvals ...any) {
Default().Log(FatalLevel, msg, keyvals...) Default().Log(FatalLevel, msg, keyvals...)
os.Exit(1) os.Exit(1)
} }
// Print logs a message with no level. // Print logs a message with no level.
func Print(msg interface{}, keyvals ...interface{}) { func Print(msg any, keyvals ...any) {
Default().Log(noLevel, msg, keyvals...) Default().Log(noLevel, msg, keyvals...)
} }
// Logf logs a message with formatting and level. // Logf logs a message with formatting and level.
func Logf(level Level, format string, args ...interface{}) { func Logf(level Level, format string, args ...any) {
Default().Logf(level, format, args...) Default().Logf(level, format, args...)
} }
// Debugf logs a debug message with formatting. // Debugf logs a debug message with formatting.
func Debugf(format string, args ...interface{}) { func Debugf(format string, args ...any) {
Default().Log(DebugLevel, fmt.Sprintf(format, args...)) Default().Log(DebugLevel, fmt.Sprintf(format, args...))
} }
// Infof logs an info message with formatting. // Infof logs an info message with formatting.
func Infof(format string, args ...interface{}) { func Infof(format string, args ...any) {
Default().Log(InfoLevel, fmt.Sprintf(format, args...)) Default().Log(InfoLevel, fmt.Sprintf(format, args...))
} }
// Warnf logs a warning message with formatting. // Warnf logs a warning message with formatting.
func Warnf(format string, args ...interface{}) { func Warnf(format string, args ...any) {
Default().Log(WarnLevel, fmt.Sprintf(format, args...)) Default().Log(WarnLevel, fmt.Sprintf(format, args...))
} }
// Errorf logs an error message with formatting. // Errorf logs an error message with formatting.
func Errorf(format string, args ...interface{}) { func Errorf(format string, args ...any) {
Default().Log(ErrorLevel, fmt.Sprintf(format, args...)) Default().Log(ErrorLevel, fmt.Sprintf(format, args...))
} }
// Fatalf logs a fatal message with formatting and exit. // Fatalf logs a fatal message with formatting and exit.
func Fatalf(format string, args ...interface{}) { func Fatalf(format string, args ...any) {
Default().Log(FatalLevel, fmt.Sprintf(format, args...)) Default().Log(FatalLevel, fmt.Sprintf(format, args...))
os.Exit(1) os.Exit(1)
} }
// Printf logs a message with formatting and no level. // Printf logs a message with formatting and no level.
func Printf(format string, args ...interface{}) { func Printf(format string, args ...any) {
Default().Log(noLevel, fmt.Sprintf(format, args...)) Default().Log(noLevel, fmt.Sprintf(format, args...))
} }
+2 -2
View File
@@ -62,7 +62,7 @@ const (
) )
var bufPool = sync.Pool{ var bufPool = sync.Pool{
New: func() interface{} { New: func() any {
return new(strings.Builder) return new(strings.Builder)
}, },
} }
@@ -164,7 +164,7 @@ func writeSpace(w io.Writer, first bool) {
} }
} }
func (l *Logger) textFormatter(keyvals ...interface{}) { func (l *Logger) textFormatter(keyvals ...any) {
st := l.styles st := l.styles
lenKeyvals := len(keyvals) lenKeyvals := len(keyvals)
+4 -2
View File
@@ -261,7 +261,7 @@ func CHA(col int) string {
// //
// See: https://vt100.net/docs/vt510-rm/CUP.html // See: https://vt100.net/docs/vt510-rm/CUP.html
func CursorPosition(col, row int) string { func CursorPosition(col, row int) string {
if row <= 0 && col <= 0 { if row <= 1 && col <= 1 {
return CursorHomePosition return CursorHomePosition
} }
@@ -281,7 +281,9 @@ func CUP(col, row int) string {
} }
// CursorHomePosition is a sequence for moving the cursor to the upper left // CursorHomePosition is a sequence for moving the cursor to the upper left
// corner of the scrolling region. This is equivalent to `CursorPosition(1, 1)`. // corner of the scrolling region.
//
// This is equivalent to [CursorPosition](1, 1).
const CursorHomePosition = "\x1b[H" const CursorHomePosition = "\x1b[H"
// SetCursorPosition (CUP) returns a sequence for setting the cursor to the // SetCursorPosition (CUP) returns a sequence for setting the cursor to the
+24
View File
@@ -1,5 +1,29 @@
package ansi package ansi
import (
"os"
"strconv"
"github.com/clipperhouse/displaywidth"
"github.com/mattn/go-runewidth"
)
var wcOptions = &runewidth.Condition{
EastAsianWidth: false,
StrictEmojiNeutral: true,
}
var dwOptions = &displaywidth.Options{
EastAsianWidth: false,
}
func init() {
if ea, err := strconv.ParseBool(os.Getenv("RUNEWIDTH_EASTASIAN")); err == nil && ea {
wcOptions.EastAsianWidth = true
dwOptions.EastAsianWidth = true
}
}
// Method is a type that represents the how the renderer should calculate the // Method is a type that represents the how the renderer should calculate the
// display width of cells. // display width of cells.
type Method uint8 type Method uint8
+154 -311
View File
@@ -108,7 +108,7 @@ func DECRST(modes ...Mode) string {
func setMode(reset bool, modes ...Mode) (s string) { func setMode(reset bool, modes ...Mode) (s string) {
if len(modes) == 0 { if len(modes) == 0 {
return //nolint:nakedret return s
} }
cmd := "h" cmd := "h"
@@ -142,7 +142,7 @@ func setMode(reset bool, modes ...Mode) (s string) {
if len(dec) > 0 { if len(dec) > 0 {
s += seq + "?" + strings.Join(dec, ";") + cmd s += seq + "?" + strings.Join(dec, ";") + cmd
} }
return //nolint:nakedret return s
} }
// RequestMode (DECRQM) returns a sequence to request a mode from the terminal. // RequestMode (DECRQM) returns a sequence to request a mode from the terminal.
@@ -228,12 +228,12 @@ func (m DECMode) Mode() int {
// //
// See: https://vt100.net/docs/vt510-rm/KAM.html // See: https://vt100.net/docs/vt510-rm/KAM.html
const ( const (
KeyboardActionMode = ANSIMode(2) ModeKeyboardAction = ANSIMode(2)
KAM = KeyboardActionMode KAM = ModeKeyboardAction
SetKeyboardActionMode = "\x1b[2h" SetModeKeyboardAction = "\x1b[2h"
ResetKeyboardActionMode = "\x1b[2l" ResetModeKeyboardAction = "\x1b[2l"
RequestKeyboardActionMode = "\x1b[2$p" RequestModeKeyboardAction = "\x1b[2$p"
) )
// Insert/Replace Mode (IRM) is a mode that determines whether characters are // Insert/Replace Mode (IRM) is a mode that determines whether characters are
@@ -245,12 +245,12 @@ const (
// //
// See: https://vt100.net/docs/vt510-rm/IRM.html // See: https://vt100.net/docs/vt510-rm/IRM.html
const ( const (
InsertReplaceMode = ANSIMode(4) ModeInsertReplace = ANSIMode(4)
IRM = InsertReplaceMode IRM = ModeInsertReplace
SetInsertReplaceMode = "\x1b[4h" SetModeInsertReplace = "\x1b[4h"
ResetInsertReplaceMode = "\x1b[4l" ResetModeInsertReplace = "\x1b[4l"
RequestInsertReplaceMode = "\x1b[4$p" RequestModeInsertReplace = "\x1b[4$p"
) )
// BiDirectional Support Mode (BDSM) is a mode that determines whether the // BiDirectional Support Mode (BDSM) is a mode that determines whether the
@@ -260,12 +260,12 @@ const (
// //
// See ECMA-48 7.2.1. // See ECMA-48 7.2.1.
const ( const (
BiDirectionalSupportMode = ANSIMode(8) ModeBiDirectionalSupport = ANSIMode(8)
BDSM = BiDirectionalSupportMode BDSM = ModeBiDirectionalSupport
SetBiDirectionalSupportMode = "\x1b[8h" SetModeBiDirectionalSupport = "\x1b[8h"
ResetBiDirectionalSupportMode = "\x1b[8l" ResetModeBiDirectionalSupport = "\x1b[8l"
RequestBiDirectionalSupportMode = "\x1b[8$p" RequestModeBiDirectionalSupport = "\x1b[8$p"
) )
// Send Receive Mode (SRM) or Local Echo Mode is a mode that determines whether // Send Receive Mode (SRM) or Local Echo Mode is a mode that determines whether
@@ -274,17 +274,17 @@ const (
// //
// See: https://vt100.net/docs/vt510-rm/SRM.html // See: https://vt100.net/docs/vt510-rm/SRM.html
const ( const (
SendReceiveMode = ANSIMode(12) ModeSendReceive = ANSIMode(12)
LocalEchoMode = SendReceiveMode ModeLocalEcho = ModeSendReceive
SRM = SendReceiveMode SRM = ModeSendReceive
SetSendReceiveMode = "\x1b[12h" SetModeSendReceive = "\x1b[12h"
ResetSendReceiveMode = "\x1b[12l" ResetModeSendReceive = "\x1b[12l"
RequestSendReceiveMode = "\x1b[12$p" RequestModeSendReceive = "\x1b[12$p"
SetLocalEchoMode = "\x1b[12h" SetModeLocalEcho = "\x1b[12h"
ResetLocalEchoMode = "\x1b[12l" ResetModeLocalEcho = "\x1b[12l"
RequestLocalEchoMode = "\x1b[12$p" RequestModeLocalEcho = "\x1b[12$p"
) )
// Line Feed/New Line Mode (LNM) is a mode that determines whether the terminal // Line Feed/New Line Mode (LNM) is a mode that determines whether the terminal
@@ -299,12 +299,12 @@ const (
// //
// See: https://vt100.net/docs/vt510-rm/LNM.html // See: https://vt100.net/docs/vt510-rm/LNM.html
const ( const (
LineFeedNewLineMode = ANSIMode(20) ModeLineFeedNewLine = ANSIMode(20)
LNM = LineFeedNewLineMode LNM = ModeLineFeedNewLine
SetLineFeedNewLineMode = "\x1b[20h" SetModeLineFeedNewLine = "\x1b[20h"
ResetLineFeedNewLineMode = "\x1b[20l" ResetModeLineFeedNewLine = "\x1b[20l"
RequestLineFeedNewLineMode = "\x1b[20$p" RequestModeLineFeedNewLine = "\x1b[20$p"
) )
// Cursor Keys Mode (DECCKM) is a mode that determines whether the cursor keys // Cursor Keys Mode (DECCKM) is a mode that determines whether the cursor keys
@@ -312,18 +312,12 @@ const (
// //
// See: https://vt100.net/docs/vt510-rm/DECCKM.html // See: https://vt100.net/docs/vt510-rm/DECCKM.html
const ( const (
CursorKeysMode = DECMode(1) ModeCursorKeys = DECMode(1)
DECCKM = CursorKeysMode DECCKM = ModeCursorKeys
SetCursorKeysMode = "\x1b[?1h" SetModeCursorKeys = "\x1b[?1h"
ResetCursorKeysMode = "\x1b[?1l" ResetModeCursorKeys = "\x1b[?1l"
RequestCursorKeysMode = "\x1b[?1$p" RequestModeCursorKeys = "\x1b[?1$p"
)
// Deprecated: use [SetCursorKeysMode] and [ResetCursorKeysMode] instead.
const (
EnableCursorKeys = "\x1b[?1h" //nolint:revive // grouped constants
DisableCursorKeys = "\x1b[?1l"
) )
// Origin Mode (DECOM) is a mode that determines whether the cursor moves to the // Origin Mode (DECOM) is a mode that determines whether the cursor moves to the
@@ -331,12 +325,12 @@ const (
// //
// See: https://vt100.net/docs/vt510-rm/DECOM.html // See: https://vt100.net/docs/vt510-rm/DECOM.html
const ( const (
OriginMode = DECMode(6) ModeOrigin = DECMode(6)
DECOM = OriginMode DECOM = ModeOrigin
SetOriginMode = "\x1b[?6h" SetModeOrigin = "\x1b[?6h"
ResetOriginMode = "\x1b[?6l" ResetModeOrigin = "\x1b[?6l"
RequestOriginMode = "\x1b[?6$p" RequestModeOrigin = "\x1b[?6$p"
) )
// Auto Wrap Mode (DECAWM) is a mode that determines whether the cursor wraps // Auto Wrap Mode (DECAWM) is a mode that determines whether the cursor wraps
@@ -344,12 +338,12 @@ const (
// //
// See: https://vt100.net/docs/vt510-rm/DECAWM.html // See: https://vt100.net/docs/vt510-rm/DECAWM.html
const ( const (
AutoWrapMode = DECMode(7) ModeAutoWrap = DECMode(7)
DECAWM = AutoWrapMode DECAWM = ModeAutoWrap
SetAutoWrapMode = "\x1b[?7h" SetModeAutoWrap = "\x1b[?7h"
ResetAutoWrapMode = "\x1b[?7l" ResetModeAutoWrap = "\x1b[?7l"
RequestAutoWrapMode = "\x1b[?7$p" RequestModeAutoWrap = "\x1b[?7$p"
) )
// X10 Mouse Mode is a mode that determines whether the mouse reports on button // X10 Mouse Mode is a mode that determines whether the mouse reports on button
@@ -364,39 +358,29 @@ const (
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( const (
X10MouseMode = DECMode(9) ModeMouseX10 = DECMode(9)
SetX10MouseMode = "\x1b[?9h" SetModeMouseX10 = "\x1b[?9h"
ResetX10MouseMode = "\x1b[?9l" ResetModeMouseX10 = "\x1b[?9l"
RequestX10MouseMode = "\x1b[?9$p" RequestModeMouseX10 = "\x1b[?9$p"
) )
// Text Cursor Enable Mode (DECTCEM) is a mode that shows/hides the cursor. // Text Cursor Enable Mode (DECTCEM) is a mode that shows/hides the cursor.
// //
// See: https://vt100.net/docs/vt510-rm/DECTCEM.html // See: https://vt100.net/docs/vt510-rm/DECTCEM.html
const ( const (
TextCursorEnableMode = DECMode(25) ModeTextCursorEnable = DECMode(25)
DECTCEM = TextCursorEnableMode DECTCEM = ModeTextCursorEnable
SetTextCursorEnableMode = "\x1b[?25h" SetModeTextCursorEnable = "\x1b[?25h"
ResetTextCursorEnableMode = "\x1b[?25l" ResetModeTextCursorEnable = "\x1b[?25l"
RequestTextCursorEnableMode = "\x1b[?25$p" RequestModeTextCursorEnable = "\x1b[?25$p"
) )
// These are aliases for [SetTextCursorEnableMode] and [ResetTextCursorEnableMode]. // These are aliases for [SetModeTextCursorEnable] and [ResetModeTextCursorEnable].
const ( const (
ShowCursor = SetTextCursorEnableMode ShowCursor = SetModeTextCursorEnable
HideCursor = ResetTextCursorEnableMode HideCursor = ResetModeTextCursorEnable
)
// Text Cursor Enable Mode (DECTCEM) is a mode that shows/hides the cursor.
//
// See: https://vt100.net/docs/vt510-rm/DECTCEM.html
//
// Deprecated: use [SetTextCursorEnableMode] and [ResetTextCursorEnableMode] instead.
const (
CursorEnableMode = DECMode(25)
RequestCursorVisibility = "\x1b[?25$p"
) )
// Numeric Keypad Mode (DECNKM) is a mode that determines whether the keypad // Numeric Keypad Mode (DECNKM) is a mode that determines whether the keypad
@@ -406,12 +390,12 @@ const (
// //
// See: https://vt100.net/docs/vt510-rm/DECNKM.html // See: https://vt100.net/docs/vt510-rm/DECNKM.html
const ( const (
NumericKeypadMode = DECMode(66) ModeNumericKeypad = DECMode(66)
DECNKM = NumericKeypadMode DECNKM = ModeNumericKeypad
SetNumericKeypadMode = "\x1b[?66h" SetModeNumericKeypad = "\x1b[?66h"
ResetNumericKeypadMode = "\x1b[?66l" ResetModeNumericKeypad = "\x1b[?66l"
RequestNumericKeypadMode = "\x1b[?66$p" RequestModeNumericKeypad = "\x1b[?66$p"
) )
// Backarrow Key Mode (DECBKM) is a mode that determines whether the backspace // Backarrow Key Mode (DECBKM) is a mode that determines whether the backspace
@@ -419,12 +403,12 @@ const (
// //
// See: https://vt100.net/docs/vt510-rm/DECBKM.html // See: https://vt100.net/docs/vt510-rm/DECBKM.html
const ( const (
BackarrowKeyMode = DECMode(67) ModeBackarrowKey = DECMode(67)
DECBKM = BackarrowKeyMode DECBKM = ModeBackarrowKey
SetBackarrowKeyMode = "\x1b[?67h" SetModeBackarrowKey = "\x1b[?67h"
ResetBackarrowKeyMode = "\x1b[?67l" ResetModeBackarrowKey = "\x1b[?67l"
RequestBackarrowKeyMode = "\x1b[?67$p" RequestModeBackarrowKey = "\x1b[?67$p"
) )
// Left Right Margin Mode (DECLRMM) is a mode that determines whether the left // Left Right Margin Mode (DECLRMM) is a mode that determines whether the left
@@ -432,47 +416,33 @@ const (
// //
// See: https://vt100.net/docs/vt510-rm/DECLRMM.html // See: https://vt100.net/docs/vt510-rm/DECLRMM.html
const ( const (
LeftRightMarginMode = DECMode(69) ModeLeftRightMargin = DECMode(69)
DECLRMM = LeftRightMarginMode DECLRMM = ModeLeftRightMargin
SetLeftRightMarginMode = "\x1b[?69h" SetModeLeftRightMargin = "\x1b[?69h"
ResetLeftRightMarginMode = "\x1b[?69l" ResetModeLeftRightMargin = "\x1b[?69l"
RequestLeftRightMarginMode = "\x1b[?69$p" RequestModeLeftRightMargin = "\x1b[?69$p"
) )
// Normal Mouse Mode is a mode that determines whether the mouse reports on // Normal Mouse Mode is a mode that determines whether the mouse reports on
// button presses and releases. It will also report modifier keys, wheel // button presses and releases. It will also report modifier keys, wheel
// events, and extra buttons. // events, and extra buttons.
// //
// It uses the same encoding as [X10MouseMode] with a few differences: // It uses the same encoding as [ModeMouseX10] with a few differences:
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( const (
NormalMouseMode = DECMode(1000) ModeMouseNormal = DECMode(1000)
SetNormalMouseMode = "\x1b[?1000h" SetModeMouseNormal = "\x1b[?1000h"
ResetNormalMouseMode = "\x1b[?1000l" ResetModeMouseNormal = "\x1b[?1000l"
RequestNormalMouseMode = "\x1b[?1000$p" RequestModeMouseNormal = "\x1b[?1000$p"
)
// VT Mouse Tracking is a mode that determines whether the mouse reports on
// button press and release.
//
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
//
// Deprecated: use [NormalMouseMode] instead.
const (
MouseMode = DECMode(1000)
EnableMouse = "\x1b[?1000h"
DisableMouse = "\x1b[?1000l"
RequestMouse = "\x1b[?1000$p"
) )
// Highlight Mouse Tracking is a mode that determines whether the mouse reports // Highlight Mouse Tracking is a mode that determines whether the mouse reports
// on button presses, releases, and highlighted cells. // on button presses, releases, and highlighted cells.
// //
// It uses the same encoding as [NormalMouseMode] with a few differences: // It uses the same encoding as [ModeMouseNormal] with a few differences:
// //
// On highlight events, the terminal responds with the following encoding: // On highlight events, the terminal responds with the following encoding:
// //
@@ -481,11 +451,11 @@ const (
// //
// Where the parameters are startx, starty, endx, endy, mousex, and mousey. // Where the parameters are startx, starty, endx, endy, mousex, and mousey.
const ( const (
HighlightMouseMode = DECMode(1001) ModeMouseHighlight = DECMode(1001)
SetHighlightMouseMode = "\x1b[?1001h" SetModeMouseHighlight = "\x1b[?1001h"
ResetHighlightMouseMode = "\x1b[?1001l" ResetModeMouseHighlight = "\x1b[?1001l"
RequestHighlightMouseMode = "\x1b[?1001$p" RequestModeMouseHighlight = "\x1b[?1001$p"
) )
// VT Hilite Mouse Tracking is a mode that determines whether the mouse reports on // VT Hilite Mouse Tracking is a mode that determines whether the mouse reports on
@@ -493,65 +463,29 @@ const (
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
// //
// Deprecated: use [HighlightMouseMode] instead.
const (
MouseHiliteMode = DECMode(1001)
EnableMouseHilite = "\x1b[?1001h" // Button Event Mouse Tracking is essentially the same as [ModeMouseNormal],
DisableMouseHilite = "\x1b[?1001l"
RequestMouseHilite = "\x1b[?1001$p"
)
// Button Event Mouse Tracking is essentially the same as [NormalMouseMode],
// but it also reports button-motion events when a button is pressed. // but it also reports button-motion events when a button is pressed.
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( const (
ButtonEventMouseMode = DECMode(1002) ModeMouseButtonEvent = DECMode(1002)
SetButtonEventMouseMode = "\x1b[?1002h" SetModeMouseButtonEvent = "\x1b[?1002h"
ResetButtonEventMouseMode = "\x1b[?1002l" ResetModeMouseButtonEvent = "\x1b[?1002l"
RequestButtonEventMouseMode = "\x1b[?1002$p" RequestModeMouseButtonEvent = "\x1b[?1002$p"
) )
// Cell Motion Mouse Tracking is a mode that determines whether the mouse // Any Event Mouse Tracking is the same as [ModeMouseButtonEvent], except that
// reports on button press, release, and motion events.
//
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
//
// Deprecated: use [ButtonEventMouseMode] instead.
const (
MouseCellMotionMode = DECMode(1002)
EnableMouseCellMotion = "\x1b[?1002h"
DisableMouseCellMotion = "\x1b[?1002l"
RequestMouseCellMotion = "\x1b[?1002$p"
)
// Any Event Mouse Tracking is the same as [ButtonEventMouseMode], except that
// all motion events are reported even if no mouse buttons are pressed. // all motion events are reported even if no mouse buttons are pressed.
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( const (
AnyEventMouseMode = DECMode(1003) ModeMouseAnyEvent = DECMode(1003)
SetAnyEventMouseMode = "\x1b[?1003h" SetModeMouseAnyEvent = "\x1b[?1003h"
ResetAnyEventMouseMode = "\x1b[?1003l" ResetModeMouseAnyEvent = "\x1b[?1003l"
RequestAnyEventMouseMode = "\x1b[?1003$p" RequestModeMouseAnyEvent = "\x1b[?1003$p"
)
// All Mouse Tracking is a mode that determines whether the mouse reports on
// button press, release, motion, and highlight events.
//
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
//
// Deprecated: use [AnyEventMouseMode] instead.
const (
MouseAllMotionMode = DECMode(1003)
EnableMouseAllMotion = "\x1b[?1003h"
DisableMouseAllMotion = "\x1b[?1003l"
RequestMouseAllMotion = "\x1b[?1003$p"
) )
// Focus Event Mode is a mode that determines whether the terminal reports focus // Focus Event Mode is a mode that determines whether the terminal reports focus
@@ -564,22 +498,11 @@ const (
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Focus-Tracking // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Focus-Tracking
const ( const (
FocusEventMode = DECMode(1004) ModeFocusEvent = DECMode(1004)
SetFocusEventMode = "\x1b[?1004h" SetModeFocusEvent = "\x1b[?1004h"
ResetFocusEventMode = "\x1b[?1004l" ResetModeFocusEvent = "\x1b[?1004l"
RequestFocusEventMode = "\x1b[?1004$p" RequestModeFocusEvent = "\x1b[?1004$p"
)
// Deprecated: use [SetFocusEventMode], [ResetFocusEventMode], and
// [RequestFocusEventMode] instead.
// Focus reporting mode constants.
const (
ReportFocusMode = DECMode(1004) //nolint:revive // grouped constants
EnableReportFocus = "\x1b[?1004h"
DisableReportFocus = "\x1b[?1004l"
RequestReportFocus = "\x1b[?1004$p"
) )
// SGR Extended Mouse Mode is a mode that changes the mouse tracking encoding // SGR Extended Mouse Mode is a mode that changes the mouse tracking encoding
@@ -589,24 +512,15 @@ const (
// //
// CSI < Cb ; Cx ; Cy M // CSI < Cb ; Cx ; Cy M
// //
// Where Cb is the same as [NormalMouseMode], and Cx and Cy are the x and y. // Where Cb is the same as [ModeMouseNormal], and Cx and Cy are the x and y.
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( const (
SgrExtMouseMode = DECMode(1006) ModeMouseExtSgr = DECMode(1006)
SetSgrExtMouseMode = "\x1b[?1006h" SetModeMouseExtSgr = "\x1b[?1006h"
ResetSgrExtMouseMode = "\x1b[?1006l" ResetModeMouseExtSgr = "\x1b[?1006l"
RequestSgrExtMouseMode = "\x1b[?1006$p" RequestModeMouseExtSgr = "\x1b[?1006$p"
)
// Deprecated: use [SgrExtMouseMode] [SetSgrExtMouseMode],
// [ResetSgrExtMouseMode], and [RequestSgrExtMouseMode] instead.
const (
MouseSgrExtMode = DECMode(1006) //nolint:revive // grouped constants
EnableMouseSgrExt = "\x1b[?1006h"
DisableMouseSgrExt = "\x1b[?1006l"
RequestMouseSgrExt = "\x1b[?1006$p"
) )
// UTF-8 Extended Mouse Mode is a mode that changes the mouse tracking encoding // UTF-8 Extended Mouse Mode is a mode that changes the mouse tracking encoding
@@ -614,11 +528,11 @@ const (
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( const (
Utf8ExtMouseMode = DECMode(1005) ModeMouseExtUtf8 = DECMode(1005)
SetUtf8ExtMouseMode = "\x1b[?1005h" SetModeMouseExtUtf8 = "\x1b[?1005h"
ResetUtf8ExtMouseMode = "\x1b[?1005l" ResetModeMouseExtUtf8 = "\x1b[?1005l"
RequestUtf8ExtMouseMode = "\x1b[?1005$p" RequestModeMouseExtUtf8 = "\x1b[?1005$p"
) )
// URXVT Extended Mouse Mode is a mode that changes the mouse tracking encoding // URXVT Extended Mouse Mode is a mode that changes the mouse tracking encoding
@@ -626,25 +540,25 @@ const (
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( const (
UrxvtExtMouseMode = DECMode(1015) ModeMouseExtUrxvt = DECMode(1015)
SetUrxvtExtMouseMode = "\x1b[?1015h" SetModeMouseExtUrxvt = "\x1b[?1015h"
ResetUrxvtExtMouseMode = "\x1b[?1015l" ResetModeMouseExtUrxvt = "\x1b[?1015l"
RequestUrxvtExtMouseMode = "\x1b[?1015$p" RequestModeMouseExtUrxvt = "\x1b[?1015$p"
) )
// SGR Pixel Extended Mouse Mode is a mode that changes the mouse tracking // SGR Pixel Extended Mouse Mode is a mode that changes the mouse tracking
// encoding to use SGR parameters with pixel coordinates. // encoding to use SGR parameters with pixel coordinates.
// //
// This is similar to [SgrExtMouseMode], but also reports pixel coordinates. // This is similar to [ModeMouseExtSgr], but also reports pixel coordinates.
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
const ( const (
SgrPixelExtMouseMode = DECMode(1016) ModeMouseExtSgrPixel = DECMode(1016)
SetSgrPixelExtMouseMode = "\x1b[?1016h" SetModeMouseExtSgrPixel = "\x1b[?1016h"
ResetSgrPixelExtMouseMode = "\x1b[?1016l" ResetModeMouseExtSgrPixel = "\x1b[?1016l"
RequestSgrPixelExtMouseMode = "\x1b[?1016$p" RequestModeMouseExtSgrPixel = "\x1b[?1016$p"
) )
// Alternate Screen Mode is a mode that determines whether the alternate screen // Alternate Screen Mode is a mode that determines whether the alternate screen
@@ -653,11 +567,11 @@ const (
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer
const ( const (
AltScreenMode = DECMode(1047) ModeAltScreen = DECMode(1047)
SetAltScreenMode = "\x1b[?1047h" SetModeAltScreen = "\x1b[?1047h"
ResetAltScreenMode = "\x1b[?1047l" ResetModeAltScreen = "\x1b[?1047l"
RequestAltScreenMode = "\x1b[?1047$p" RequestModeAltScreen = "\x1b[?1047$p"
) )
// Save Cursor Mode is a mode that saves the cursor position. // Save Cursor Mode is a mode that saves the cursor position.
@@ -665,42 +579,24 @@ const (
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer
const ( const (
SaveCursorMode = DECMode(1048) ModeSaveCursor = DECMode(1048)
SetSaveCursorMode = "\x1b[?1048h" SetModeSaveCursor = "\x1b[?1048h"
ResetSaveCursorMode = "\x1b[?1048l" ResetModeSaveCursor = "\x1b[?1048l"
RequestSaveCursorMode = "\x1b[?1048$p" RequestModeSaveCursor = "\x1b[?1048$p"
) )
// Alternate Screen Save Cursor Mode is a mode that saves the cursor position as in // Alternate Screen Save Cursor Mode is a mode that saves the cursor position as in
// [SaveCursorMode], switches to the alternate screen buffer as in [AltScreenMode], // [ModeSaveCursor], switches to the alternate screen buffer as in [ModeAltScreen],
// and clears the screen on switch. // and clears the screen on switch.
// //
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer
const ( const (
AltScreenSaveCursorMode = DECMode(1049) ModeAltScreenSaveCursor = DECMode(1049)
SetAltScreenSaveCursorMode = "\x1b[?1049h" SetModeAltScreenSaveCursor = "\x1b[?1049h"
ResetAltScreenSaveCursorMode = "\x1b[?1049l" ResetModeAltScreenSaveCursor = "\x1b[?1049l"
RequestAltScreenSaveCursorMode = "\x1b[?1049$p" RequestModeAltScreenSaveCursor = "\x1b[?1049$p"
)
// Alternate Screen Buffer is a mode that determines whether the alternate screen
// buffer is active.
//
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer
//
// Deprecated: use [AltScreenSaveCursorMode] instead.
const (
AltScreenBufferMode = DECMode(1049)
SetAltScreenBufferMode = "\x1b[?1049h"
ResetAltScreenBufferMode = "\x1b[?1049l"
RequestAltScreenBufferMode = "\x1b[?1049$p"
EnableAltScreenBuffer = "\x1b[?1049h"
DisableAltScreenBuffer = "\x1b[?1049l"
RequestAltScreenBuffer = "\x1b[?1049$p"
) )
// Bracketed Paste Mode is a mode that determines whether pasted text is // Bracketed Paste Mode is a mode that determines whether pasted text is
@@ -709,19 +605,11 @@ const (
// See: https://cirw.in/blog/bracketed-paste // See: https://cirw.in/blog/bracketed-paste
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Bracketed-Paste-Mode // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Bracketed-Paste-Mode
const ( const (
BracketedPasteMode = DECMode(2004) ModeBracketedPaste = DECMode(2004)
SetBracketedPasteMode = "\x1b[?2004h" SetModeBracketedPaste = "\x1b[?2004h"
ResetBracketedPasteMode = "\x1b[?2004l" ResetModeBracketedPaste = "\x1b[?2004l"
RequestBracketedPasteMode = "\x1b[?2004$p" RequestModeBracketedPaste = "\x1b[?2004$p"
)
// Deprecated: use [SetBracketedPasteMode], [ResetBracketedPasteMode], and
// [RequestBracketedPasteMode] instead.
const (
EnableBracketedPaste = "\x1b[?2004h" //nolint:revive // grouped constants
DisableBracketedPaste = "\x1b[?2004l"
RequestBracketedPaste = "\x1b[?2004$p"
) )
// Synchronized Output Mode is a mode that determines whether output is // Synchronized Output Mode is a mode that determines whether output is
@@ -729,23 +617,11 @@ const (
// //
// See: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036 // See: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036
const ( const (
SynchronizedOutputMode = DECMode(2026) ModeSynchronizedOutput = DECMode(2026)
SetSynchronizedOutputMode = "\x1b[?2026h" SetModeSynchronizedOutput = "\x1b[?2026h"
ResetSynchronizedOutputMode = "\x1b[?2026l" ResetModeSynchronizedOutput = "\x1b[?2026l"
RequestSynchronizedOutputMode = "\x1b[?2026$p" RequestModeSynchronizedOutput = "\x1b[?2026$p"
)
// Synchronized Output Mode. See [SynchronizedOutputMode].
//
// Deprecated: use [SynchronizedOutputMode], [SetSynchronizedOutputMode], and
// [ResetSynchronizedOutputMode], and [RequestSynchronizedOutputMode] instead.
const (
SyncdOutputMode = DECMode(2026)
EnableSyncdOutput = "\x1b[?2026h"
DisableSyncdOutput = "\x1b[?2026l"
RequestSyncdOutput = "\x1b[?2026$p"
) )
// Unicode Core Mode is a mode that determines whether the terminal should use // Unicode Core Mode is a mode that determines whether the terminal should use
@@ -754,41 +630,16 @@ const (
// //
// See: https://github.com/contour-terminal/terminal-unicode-core // See: https://github.com/contour-terminal/terminal-unicode-core
const ( const (
UnicodeCoreMode = DECMode(2027) ModeUnicodeCore = DECMode(2027)
SetUnicodeCoreMode = "\x1b[?2027h" SetModeUnicodeCore = "\x1b[?2027h"
ResetUnicodeCoreMode = "\x1b[?2027l" ResetModeUnicodeCore = "\x1b[?2027l"
RequestUnicodeCoreMode = "\x1b[?2027$p" RequestModeUnicodeCore = "\x1b[?2027$p"
) )
// Grapheme Clustering Mode is a mode that determines whether the terminal
// should look for grapheme clusters instead of single runes in the rendered
// text. This makes the terminal properly render combining characters such as
// emojis.
// //
// See: https://github.com/contour-terminal/terminal-unicode-core
//
// Deprecated: use [GraphemeClusteringMode], [SetUnicodeCoreMode],
// [ResetUnicodeCoreMode], and [RequestUnicodeCoreMode] instead.
const (
GraphemeClusteringMode = DECMode(2027)
SetGraphemeClusteringMode = "\x1b[?2027h" // ModeLightDark is a mode that enables reporting the operating system's color
ResetGraphemeClusteringMode = "\x1b[?2027l"
RequestGraphemeClusteringMode = "\x1b[?2027$p"
)
// Grapheme Clustering Mode. See [GraphemeClusteringMode].
//
// Deprecated: use [SetUnicodeCoreMode], [ResetUnicodeCoreMode], and
// [RequestUnicodeCoreMode] instead.
const (
EnableGraphemeClustering = "\x1b[?2027h"
DisableGraphemeClustering = "\x1b[?2027l"
RequestGraphemeClustering = "\x1b[?2027$p"
)
// LightDarkMode is a mode that enables reporting the operating system's color
// scheme (light or dark) preference. It reports the color scheme as a [DSR] // scheme (light or dark) preference. It reports the color scheme as a [DSR]
// and [LightDarkReport] escape sequences encoded as follows: // and [LightDarkReport] escape sequences encoded as follows:
// //
@@ -802,14 +653,14 @@ const (
// //
// See: https://contour-terminal.org/vt-extensions/color-palette-update-notifications/ // See: https://contour-terminal.org/vt-extensions/color-palette-update-notifications/
const ( const (
LightDarkMode = DECMode(2031) ModeLightDark = DECMode(2031)
SetLightDarkMode = "\x1b[?2031h" SetModeLightDark = "\x1b[?2031h"
ResetLightDarkMode = "\x1b[?2031l" ResetModeLightDark = "\x1b[?2031l"
RequestLightDarkMode = "\x1b[?2031$p" RequestModeLightDark = "\x1b[?2031$p"
) )
// InBandResizeMode is a mode that reports terminal resize events as escape // ModeInBandResize is a mode that reports terminal resize events as escape
// sequences. This is useful for systems that do not support [SIGWINCH] like // sequences. This is useful for systems that do not support [SIGWINCH] like
// Windows. // Windows.
// //
@@ -819,11 +670,11 @@ const (
// //
// See: https://gist.github.com/rockorager/e695fb2924d36b2bcf1fff4a3704bd83 // See: https://gist.github.com/rockorager/e695fb2924d36b2bcf1fff4a3704bd83
const ( const (
InBandResizeMode = DECMode(2048) ModeInBandResize = DECMode(2048)
SetInBandResizeMode = "\x1b[?2048h" SetModeInBandResize = "\x1b[?2048h"
ResetInBandResizeMode = "\x1b[?2048l" ResetModeInBandResize = "\x1b[?2048l"
RequestInBandResizeMode = "\x1b[?2048$p" RequestModeInBandResize = "\x1b[?2048$p"
) )
// Win32Input is a mode that determines whether input is processed by the // Win32Input is a mode that determines whether input is processed by the
@@ -831,17 +682,9 @@ const (
// //
// See: https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md // See: https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md
const ( const (
Win32InputMode = DECMode(9001) ModeWin32Input = DECMode(9001)
SetWin32InputMode = "\x1b[?9001h" SetModeWin32Input = "\x1b[?9001h"
ResetWin32InputMode = "\x1b[?9001l" ResetModeWin32Input = "\x1b[?9001l"
RequestWin32InputMode = "\x1b[?9001$p" RequestModeWin32Input = "\x1b[?9001$p"
)
// Deprecated: use [SetWin32InputMode], [ResetWin32InputMode], and
// [RequestWin32InputMode] instead.
const (
EnableWin32Input = "\x1b[?9001h" //nolint:revive // grouped constants
DisableWin32Input = "\x1b[?9001l"
RequestWin32Input = "\x1b[?9001$p"
) )
+495
View File
@@ -0,0 +1,495 @@
package ansi
// Keyboard Action Mode (KAM) controls locking of the keyboard.
//
// Deprecated: use [ModeKeyboardAction] instead.
const (
KeyboardActionMode = ANSIMode(2)
SetKeyboardActionMode = "\x1b[2h"
ResetKeyboardActionMode = "\x1b[2l"
RequestKeyboardActionMode = "\x1b[2$p"
)
// Insert/Replace Mode (IRM) determines whether characters are inserted or replaced.
//
// Deprecated: use [ModeInsertReplace] instead.
const (
InsertReplaceMode = ANSIMode(4)
SetInsertReplaceMode = "\x1b[4h"
ResetInsertReplaceMode = "\x1b[4l"
RequestInsertReplaceMode = "\x1b[4$p"
)
// BiDirectional Support Mode (BDSM) determines whether the terminal supports bidirectional text.
//
// Deprecated: use [ModeBiDirectionalSupport] instead.
const (
BiDirectionalSupportMode = ANSIMode(8)
SetBiDirectionalSupportMode = "\x1b[8h"
ResetBiDirectionalSupportMode = "\x1b[8l"
RequestBiDirectionalSupportMode = "\x1b[8$p"
)
// Send Receive Mode (SRM) or Local Echo Mode determines whether the terminal echoes characters.
//
// Deprecated: use [ModeSendReceive] instead.
const (
SendReceiveMode = ANSIMode(12)
LocalEchoMode = SendReceiveMode
SetSendReceiveMode = "\x1b[12h"
ResetSendReceiveMode = "\x1b[12l"
RequestSendReceiveMode = "\x1b[12$p"
SetLocalEchoMode = "\x1b[12h"
ResetLocalEchoMode = "\x1b[12l"
RequestLocalEchoMode = "\x1b[12$p"
)
// Line Feed/New Line Mode (LNM) determines whether the terminal interprets line feed as new line.
//
// Deprecated: use [ModeLineFeedNewLine] instead.
const (
LineFeedNewLineMode = ANSIMode(20)
SetLineFeedNewLineMode = "\x1b[20h"
ResetLineFeedNewLineMode = "\x1b[20l"
RequestLineFeedNewLineMode = "\x1b[20$p"
)
// Cursor Keys Mode (DECCKM) determines whether cursor keys send ANSI or application sequences.
//
// Deprecated: use [ModeCursorKeys] instead.
const (
CursorKeysMode = DECMode(1)
SetCursorKeysMode = "\x1b[?1h"
ResetCursorKeysMode = "\x1b[?1l"
RequestCursorKeysMode = "\x1b[?1$p"
)
// Cursor Keys mode.
//
// Deprecated: use [SetModeCursorKeys] and [ResetModeCursorKeys] instead.
const (
EnableCursorKeys = "\x1b[?1h"
DisableCursorKeys = "\x1b[?1l"
)
// Origin Mode (DECOM) determines whether the cursor moves to home or margin position.
//
// Deprecated: use [ModeOrigin] instead.
const (
OriginMode = DECMode(6)
SetOriginMode = "\x1b[?6h"
ResetOriginMode = "\x1b[?6l"
RequestOriginMode = "\x1b[?6$p"
)
// Auto Wrap Mode (DECAWM) determines whether the cursor wraps to the next line.
//
// Deprecated: use [ModeAutoWrap] instead.
const (
AutoWrapMode = DECMode(7)
SetAutoWrapMode = "\x1b[?7h"
ResetAutoWrapMode = "\x1b[?7l"
RequestAutoWrapMode = "\x1b[?7$p"
)
// X10 Mouse Mode determines whether the mouse reports on button presses.
//
// Deprecated: use [ModeMouseX10] instead.
const (
X10MouseMode = DECMode(9)
SetX10MouseMode = "\x1b[?9h"
ResetX10MouseMode = "\x1b[?9l"
RequestX10MouseMode = "\x1b[?9$p"
)
// Text Cursor Enable Mode (DECTCEM) shows/hides the cursor.
//
// Deprecated: use [ModeTextCursorEnable] instead.
const (
TextCursorEnableMode = DECMode(25)
SetTextCursorEnableMode = "\x1b[?25h"
ResetTextCursorEnableMode = "\x1b[?25l"
RequestTextCursorEnableMode = "\x1b[?25$p"
)
// Text Cursor Enable mode.
//
// Deprecated: use [SetModeTextCursorEnable] and [ResetModeTextCursorEnable] instead.
const (
CursorEnableMode = DECMode(25)
RequestCursorVisibility = "\x1b[?25$p"
)
// Numeric Keypad Mode (DECNKM) determines whether the keypad sends application or numeric sequences.
//
// Deprecated: use [ModeNumericKeypad] instead.
const (
NumericKeypadMode = DECMode(66)
SetNumericKeypadMode = "\x1b[?66h"
ResetNumericKeypadMode = "\x1b[?66l"
RequestNumericKeypadMode = "\x1b[?66$p"
)
// Backarrow Key Mode (DECBKM) determines whether the backspace key sends backspace or delete.
//
// Deprecated: use [ModeBackarrowKey] instead.
const (
BackarrowKeyMode = DECMode(67)
SetBackarrowKeyMode = "\x1b[?67h"
ResetBackarrowKeyMode = "\x1b[?67l"
RequestBackarrowKeyMode = "\x1b[?67$p"
)
// Left Right Margin Mode (DECLRMM) determines whether left and right margins can be set.
//
// Deprecated: use [ModeLeftRightMargin] instead.
const (
LeftRightMarginMode = DECMode(69)
SetLeftRightMarginMode = "\x1b[?69h"
ResetLeftRightMarginMode = "\x1b[?69l"
RequestLeftRightMarginMode = "\x1b[?69$p"
)
// Normal Mouse Mode determines whether the mouse reports on button presses and releases.
//
// Deprecated: use [ModeMouseNormal] instead.
const (
NormalMouseMode = DECMode(1000)
SetNormalMouseMode = "\x1b[?1000h"
ResetNormalMouseMode = "\x1b[?1000l"
RequestNormalMouseMode = "\x1b[?1000$p"
)
// VT Mouse Tracking mode.
//
// Deprecated: use [ModeMouseNormal] instead.
const (
MouseMode = DECMode(1000)
EnableMouse = "\x1b[?1000h"
DisableMouse = "\x1b[?1000l"
RequestMouse = "\x1b[?1000$p"
)
// Highlight Mouse Tracking determines whether the mouse reports on button presses and highlighted cells.
//
// Deprecated: use [ModeMouseHighlight] instead.
const (
HighlightMouseMode = DECMode(1001)
SetHighlightMouseMode = "\x1b[?1001h"
ResetHighlightMouseMode = "\x1b[?1001l"
RequestHighlightMouseMode = "\x1b[?1001$p"
)
// VT Hilite Mouse Tracking mode.
//
// Deprecated: use [ModeMouseHighlight] instead.
const (
MouseHiliteMode = DECMode(1001)
EnableMouseHilite = "\x1b[?1001h"
DisableMouseHilite = "\x1b[?1001l"
RequestMouseHilite = "\x1b[?1001$p"
)
// Button Event Mouse Tracking reports button-motion events when a button is pressed.
//
// Deprecated: use [ModeMouseButtonEvent] instead.
const (
ButtonEventMouseMode = DECMode(1002)
SetButtonEventMouseMode = "\x1b[?1002h"
ResetButtonEventMouseMode = "\x1b[?1002l"
RequestButtonEventMouseMode = "\x1b[?1002$p"
)
// Cell Motion Mouse Tracking mode.
//
// Deprecated: use [ModeMouseButtonEvent] instead.
const (
MouseCellMotionMode = DECMode(1002)
EnableMouseCellMotion = "\x1b[?1002h"
DisableMouseCellMotion = "\x1b[?1002l"
RequestMouseCellMotion = "\x1b[?1002$p"
)
// Any Event Mouse Tracking reports all motion events.
//
// Deprecated: use [ModeMouseAnyEvent] instead.
const (
AnyEventMouseMode = DECMode(1003)
SetAnyEventMouseMode = "\x1b[?1003h"
ResetAnyEventMouseMode = "\x1b[?1003l"
RequestAnyEventMouseMode = "\x1b[?1003$p"
)
// All Mouse Tracking mode.
//
// Deprecated: use [ModeMouseAnyEvent] instead.
const (
MouseAllMotionMode = DECMode(1003)
EnableMouseAllMotion = "\x1b[?1003h"
DisableMouseAllMotion = "\x1b[?1003l"
RequestMouseAllMotion = "\x1b[?1003$p"
)
// Focus Event Mode determines whether the terminal reports focus and blur events.
//
// Deprecated: use [ModeFocusEvent] instead.
const (
FocusEventMode = DECMode(1004)
SetFocusEventMode = "\x1b[?1004h"
ResetFocusEventMode = "\x1b[?1004l"
RequestFocusEventMode = "\x1b[?1004$p"
)
// Focus reporting mode.
//
// Deprecated: use [SetModeFocusEvent], [ResetModeFocusEvent], and
// [RequestModeFocusEvent] instead.
const (
ReportFocusMode = DECMode(1004)
EnableReportFocus = "\x1b[?1004h"
DisableReportFocus = "\x1b[?1004l"
RequestReportFocus = "\x1b[?1004$p"
)
// UTF-8 Extended Mouse Mode changes the mouse tracking encoding to use UTF-8 parameters.
//
// Deprecated: use [ModeMouseExtUtf8] instead.
const (
Utf8ExtMouseMode = DECMode(1005)
SetUtf8ExtMouseMode = "\x1b[?1005h"
ResetUtf8ExtMouseMode = "\x1b[?1005l"
RequestUtf8ExtMouseMode = "\x1b[?1005$p"
)
// SGR Extended Mouse Mode changes the mouse tracking encoding to use SGR parameters.
//
// Deprecated: use [ModeMouseExtSgr] instead.
const (
SgrExtMouseMode = DECMode(1006)
SetSgrExtMouseMode = "\x1b[?1006h"
ResetSgrExtMouseMode = "\x1b[?1006l"
RequestSgrExtMouseMode = "\x1b[?1006$p"
)
// Mouse SGR Extended mode.
//
// Deprecated: use [ModeMouseExtSgr], [SetModeMouseExtSgr],
// [ResetModeMouseExtSgr], and [RequestModeMouseExtSgr] instead.
const (
MouseSgrExtMode = DECMode(1006)
EnableMouseSgrExt = "\x1b[?1006h"
DisableMouseSgrExt = "\x1b[?1006l"
RequestMouseSgrExt = "\x1b[?1006$p"
)
// URXVT Extended Mouse Mode changes the mouse tracking encoding to use an alternate encoding.
//
// Deprecated: use [ModeMouseUrxvtExt] instead.
const (
UrxvtExtMouseMode = DECMode(1015)
SetUrxvtExtMouseMode = "\x1b[?1015h"
ResetUrxvtExtMouseMode = "\x1b[?1015l"
RequestUrxvtExtMouseMode = "\x1b[?1015$p"
)
// SGR Pixel Extended Mouse Mode changes the mouse tracking encoding to use SGR parameters with pixel coordinates.
//
// Deprecated: use [ModeMouseExtSgrPixel] instead.
const (
SgrPixelExtMouseMode = DECMode(1016)
SetSgrPixelExtMouseMode = "\x1b[?1016h"
ResetSgrPixelExtMouseMode = "\x1b[?1016l"
RequestSgrPixelExtMouseMode = "\x1b[?1016$p"
)
// Alternate Screen Mode determines whether the alternate screen buffer is active.
//
// Deprecated: use [ModeAltScreen] instead.
const (
AltScreenMode = DECMode(1047)
SetAltScreenMode = "\x1b[?1047h"
ResetAltScreenMode = "\x1b[?1047l"
RequestAltScreenMode = "\x1b[?1047$p"
)
// Save Cursor Mode saves the cursor position.
//
// Deprecated: use [ModeSaveCursor] instead.
const (
SaveCursorMode = DECMode(1048)
SetSaveCursorMode = "\x1b[?1048h"
ResetSaveCursorMode = "\x1b[?1048l"
RequestSaveCursorMode = "\x1b[?1048$p"
)
// Alternate Screen Save Cursor Mode saves the cursor position and switches to alternate screen.
//
// Deprecated: use [ModeAltScreenSaveCursor] instead.
const (
AltScreenSaveCursorMode = DECMode(1049)
SetAltScreenSaveCursorMode = "\x1b[?1049h"
ResetAltScreenSaveCursorMode = "\x1b[?1049l"
RequestAltScreenSaveCursorMode = "\x1b[?1049$p"
)
// Alternate Screen Buffer mode.
//
// Deprecated: use [ModeAltScreenSaveCursor] instead.
const (
AltScreenBufferMode = DECMode(1049)
SetAltScreenBufferMode = "\x1b[?1049h"
ResetAltScreenBufferMode = "\x1b[?1049l"
RequestAltScreenBufferMode = "\x1b[?1049$p"
EnableAltScreenBuffer = "\x1b[?1049h"
DisableAltScreenBuffer = "\x1b[?1049l"
RequestAltScreenBuffer = "\x1b[?1049$p"
)
// Bracketed Paste Mode determines whether pasted text is bracketed with escape sequences.
//
// Deprecated: use [ModeBracketedPaste] instead.
const (
BracketedPasteMode = DECMode(2004)
SetBracketedPasteMode = "\x1b[?2004h"
ResetBracketedPasteMode = "\x1b[?2004l"
RequestBracketedPasteMode = "\x1b[?2004$p"
)
// Deprecated: use [SetModeBracketedPaste], [ResetModeBracketedPaste], and
// [RequestModeBracketedPaste] instead.
const (
EnableBracketedPaste = "\x1b[?2004h" //nolint:revive
DisableBracketedPaste = "\x1b[?2004l"
RequestBracketedPaste = "\x1b[?2004$p"
)
// Synchronized Output Mode determines whether output is synchronized with the terminal.
//
// Deprecated: use [ModeSynchronizedOutput] instead.
const (
SynchronizedOutputMode = DECMode(2026)
SetSynchronizedOutputMode = "\x1b[?2026h"
ResetSynchronizedOutputMode = "\x1b[?2026l"
RequestSynchronizedOutputMode = "\x1b[?2026$p"
)
// Synchronized output mode.
//
// Deprecated: use [ModeSynchronizedOutput], [SetModeSynchronizedOutput],
// [ResetModeSynchronizedOutput], and [RequestModeSynchronizedOutput] instead.
const (
SyncdOutputMode = DECMode(2026)
EnableSyncdOutput = "\x1b[?2026h"
DisableSyncdOutput = "\x1b[?2026l"
RequestSyncdOutput = "\x1b[?2026$p"
)
// Unicode Core Mode determines whether the terminal uses Unicode grapheme clustering.
//
// Deprecated: use [ModeUnicodeCore] instead.
const (
UnicodeCoreMode = DECMode(2027)
SetUnicodeCoreMode = "\x1b[?2027h"
ResetUnicodeCoreMode = "\x1b[?2027l"
RequestUnicodeCoreMode = "\x1b[?2027$p"
)
// Grapheme Clustering Mode determines whether the terminal looks for grapheme clusters.
//
// Deprecated: use [ModeUnicodeCore], [SetModeUnicodeCore],
// [ResetModeUnicodeCore], and [RequestModeUnicodeCore] instead.
const (
GraphemeClusteringMode = DECMode(2027)
SetGraphemeClusteringMode = "\x1b[?2027h"
ResetGraphemeClusteringMode = "\x1b[?2027l"
RequestGraphemeClusteringMode = "\x1b[?2027$p"
)
// Unicode Core mode.
//
// Deprecated: use [SetModeUnicodeCore], [ResetModeUnicodeCore], and
// [RequestModeUnicodeCore] instead.
const (
EnableGraphemeClustering = "\x1b[?2027h"
DisableGraphemeClustering = "\x1b[?2027l"
RequestGraphemeClustering = "\x1b[?2027$p"
)
// Light Dark Mode enables reporting the operating system's color scheme preference.
//
// Deprecated: use [ModeLightDark] instead.
const (
LightDarkMode = DECMode(2031)
SetLightDarkMode = "\x1b[?2031h"
ResetLightDarkMode = "\x1b[?2031l"
RequestLightDarkMode = "\x1b[?2031$p"
)
// In Band Resize Mode reports terminal resize events as escape sequences.
//
// Deprecated: use [ModeInBandResize] instead.
const (
InBandResizeMode = DECMode(2048)
SetInBandResizeMode = "\x1b[?2048h"
ResetInBandResizeMode = "\x1b[?2048l"
RequestInBandResizeMode = "\x1b[?2048$p"
)
// Win32Input determines whether input is processed by the Win32 console and Conpty.
//
// Deprecated: use [ModeWin32Input] instead.
const (
Win32InputMode = DECMode(9001)
SetWin32InputMode = "\x1b[?9001h"
ResetWin32InputMode = "\x1b[?9001l"
RequestWin32InputMode = "\x1b[?9001$p"
)
// Deprecated: use [SetModeWin32Input], [ResetModeWin32Input], and
// [RequestModeWin32Input] instead.
const (
EnableWin32Input = "\x1b[?9001h" //nolint:revive
DisableWin32Input = "\x1b[?9001l"
RequestWin32Input = "\x1b[?9001$p"
)
+1 -1
View File
@@ -134,7 +134,7 @@ func EncodeMouseButton(b MouseButton, motion, shift, alt, ctrl bool) (m byte) {
m |= bitMotion m |= bitMotion
} }
return //nolint:nakedret return m
} }
// x10Offset is the offset for X10 mouse events. // x10Offset is the offset for X10 mouse events.
+19
View File
@@ -1,5 +1,10 @@
package ansi package ansi
import (
"fmt"
"strings"
)
// Notify sends a desktop notification using iTerm's OSC 9. // Notify sends a desktop notification using iTerm's OSC 9.
// //
// OSC 9 ; Mc ST // OSC 9 ; Mc ST
@@ -11,3 +16,17 @@ package ansi
func Notify(s string) string { func Notify(s string) string {
return "\x1b]9;" + s + "\x07" return "\x1b]9;" + s + "\x07"
} }
// DesktopNotification sends a desktop notification based on the extensible OSC
// 99 escape code.
//
// OSC 99 ; <metadata> ; <payload> ST
// OSC 99 ; <metadata> ; <payload> BEL
//
// Where <metadata> is a colon-separated list of key-value pairs, and
// <payload> is the notification body.
//
// See: https://sw.kovidgoyal.net/kitty/desktop-notifications/
func DesktopNotification(payload string, metadata ...string) string {
return fmt.Sprintf("\x1b]99;%s;%s\x07", strings.Join(metadata, ":"), payload)
}
+17 -16
View File
@@ -4,8 +4,7 @@ import (
"unicode/utf8" "unicode/utf8"
"github.com/charmbracelet/x/ansi/parser" "github.com/charmbracelet/x/ansi/parser"
"github.com/mattn/go-runewidth" "github.com/clipperhouse/uax29/v2/graphemes"
"github.com/rivo/uniseg"
) )
// State represents the state of the ANSI escape sequence parser used by // State represents the state of the ANSI escape sequence parser used by
@@ -176,10 +175,7 @@ func decodeSequence[T string | []byte](m Method, b T, state State, p *Parser) (s
} }
if utf8.RuneStart(c) { if utf8.RuneStart(c) {
seq, _, width, _ = FirstGraphemeCluster(b, -1) seq, width = FirstGraphemeCluster(b, m)
if m == WcWidth {
width = runewidth.StringWidth(string(seq))
}
i += len(seq) i += len(seq)
return b[:i], width, i, NormalState return b[:i], width, i, NormalState
} }
@@ -434,17 +430,22 @@ func HasEscPrefix[T string | []byte](b T) bool {
return len(b) > 0 && b[0] == ESC return len(b) > 0 && b[0] == ESC
} }
// FirstGraphemeCluster returns the first grapheme cluster in the given string or byte slice. // FirstGraphemeCluster returns the first grapheme cluster in the given string
// This is a syntactic sugar function that wraps // or byte slice, and its monospace display width.
// uniseg.FirstGraphemeClusterInString and uniseg.FirstGraphemeCluster. func FirstGraphemeCluster[T string | []byte](b T, m Method) (T, int) {
func FirstGraphemeCluster[T string | []byte](b T, state int) (T, T, int, int) {
switch b := any(b).(type) { switch b := any(b).(type) {
case string: case string:
cluster, rest, width, newState := uniseg.FirstGraphemeClusterInString(b, state) cluster := graphemes.FromString(b).First()
return T(cluster), T(rest), width, newState if m == WcWidth {
return T(cluster), wcOptions.StringWidth(cluster)
}
return T(cluster), dwOptions.String(cluster)
case []byte: case []byte:
cluster, rest, width, newState := uniseg.FirstGraphemeCluster(b, state) cluster := graphemes.FromBytes(b).First()
return T(cluster), T(rest), width, newState if m == WcWidth {
return T(cluster), wcOptions.StringWidth(string(cluster))
}
return T(cluster), dwOptions.Bytes(cluster)
} }
panic("unreachable") panic("unreachable")
} }
@@ -490,7 +491,7 @@ func Command(prefix, inter, final byte) (c int) {
c = int(final) c = int(final)
c |= int(prefix) << parser.PrefixShift c |= int(prefix) << parser.PrefixShift
c |= int(inter) << parser.IntermedShift c |= int(inter) << parser.IntermedShift
return return c
} }
// Param represents a sequence parameter. Sequence parameters with // Param represents a sequence parameter. Sequence parameters with
@@ -520,5 +521,5 @@ func Parameter(p int, hasMore bool) (s int) {
if hasMore { if hasMore {
s |= parser.HasMoreFlag s |= parser.HasMoreFlag
} }
return return s
} }
+1 -1
View File
@@ -10,7 +10,7 @@ var parserPool = sync.Pool{
New: func() any { New: func() any {
p := NewParser() p := NewParser()
p.SetParamsSize(parser.MaxParamsSize) p.SetParamsSize(parser.MaxParamsSize)
p.SetDataSize(1024 * 1024 * 4) // 4MB of data buffer p.SetDataSize(1024 * 4) // 4KB of data buffer
return p return p
}, },
} }
+55 -55
View File
@@ -21,59 +21,59 @@ func SGR(ps ...Attr) string {
} }
var attrStrings = map[int]string{ var attrStrings = map[int]string{
ResetAttr: resetAttr, AttrReset: attrReset,
BoldAttr: boldAttr, AttrBold: attrBold,
FaintAttr: faintAttr, AttrFaint: attrFaint,
ItalicAttr: italicAttr, AttrItalic: attrItalic,
UnderlineAttr: underlineAttr, AttrUnderline: attrUnderline,
SlowBlinkAttr: slowBlinkAttr, AttrBlink: attrBlink,
RapidBlinkAttr: rapidBlinkAttr, AttrRapidBlink: attrRapidBlink,
ReverseAttr: reverseAttr, AttrReverse: attrReverse,
ConcealAttr: concealAttr, AttrConceal: attrConceal,
StrikethroughAttr: strikethroughAttr, AttrStrikethrough: attrStrikethrough,
NormalIntensityAttr: normalIntensityAttr, AttrNormalIntensity: attrNormalIntensity,
NoItalicAttr: noItalicAttr, AttrNoItalic: attrNoItalic,
NoUnderlineAttr: noUnderlineAttr, AttrNoUnderline: attrNoUnderline,
NoBlinkAttr: noBlinkAttr, AttrNoBlink: attrNoBlink,
NoReverseAttr: noReverseAttr, AttrNoReverse: attrNoReverse,
NoConcealAttr: noConcealAttr, AttrNoConceal: attrNoConceal,
NoStrikethroughAttr: noStrikethroughAttr, AttrNoStrikethrough: attrNoStrikethrough,
BlackForegroundColorAttr: blackForegroundColorAttr, AttrBlackForegroundColor: attrBlackForegroundColor,
RedForegroundColorAttr: redForegroundColorAttr, AttrRedForegroundColor: attrRedForegroundColor,
GreenForegroundColorAttr: greenForegroundColorAttr, AttrGreenForegroundColor: attrGreenForegroundColor,
YellowForegroundColorAttr: yellowForegroundColorAttr, AttrYellowForegroundColor: attrYellowForegroundColor,
BlueForegroundColorAttr: blueForegroundColorAttr, AttrBlueForegroundColor: attrBlueForegroundColor,
MagentaForegroundColorAttr: magentaForegroundColorAttr, AttrMagentaForegroundColor: attrMagentaForegroundColor,
CyanForegroundColorAttr: cyanForegroundColorAttr, AttrCyanForegroundColor: attrCyanForegroundColor,
WhiteForegroundColorAttr: whiteForegroundColorAttr, AttrWhiteForegroundColor: attrWhiteForegroundColor,
ExtendedForegroundColorAttr: extendedForegroundColorAttr, AttrExtendedForegroundColor: attrExtendedForegroundColor,
DefaultForegroundColorAttr: defaultForegroundColorAttr, AttrDefaultForegroundColor: attrDefaultForegroundColor,
BlackBackgroundColorAttr: blackBackgroundColorAttr, AttrBlackBackgroundColor: attrBlackBackgroundColor,
RedBackgroundColorAttr: redBackgroundColorAttr, AttrRedBackgroundColor: attrRedBackgroundColor,
GreenBackgroundColorAttr: greenBackgroundColorAttr, AttrGreenBackgroundColor: attrGreenBackgroundColor,
YellowBackgroundColorAttr: yellowBackgroundColorAttr, AttrYellowBackgroundColor: attrYellowBackgroundColor,
BlueBackgroundColorAttr: blueBackgroundColorAttr, AttrBlueBackgroundColor: attrBlueBackgroundColor,
MagentaBackgroundColorAttr: magentaBackgroundColorAttr, AttrMagentaBackgroundColor: attrMagentaBackgroundColor,
CyanBackgroundColorAttr: cyanBackgroundColorAttr, AttrCyanBackgroundColor: attrCyanBackgroundColor,
WhiteBackgroundColorAttr: whiteBackgroundColorAttr, AttrWhiteBackgroundColor: attrWhiteBackgroundColor,
ExtendedBackgroundColorAttr: extendedBackgroundColorAttr, AttrExtendedBackgroundColor: attrExtendedBackgroundColor,
DefaultBackgroundColorAttr: defaultBackgroundColorAttr, AttrDefaultBackgroundColor: attrDefaultBackgroundColor,
ExtendedUnderlineColorAttr: extendedUnderlineColorAttr, AttrExtendedUnderlineColor: attrExtendedUnderlineColor,
DefaultUnderlineColorAttr: defaultUnderlineColorAttr, AttrDefaultUnderlineColor: attrDefaultUnderlineColor,
BrightBlackForegroundColorAttr: brightBlackForegroundColorAttr, AttrBrightBlackForegroundColor: attrBrightBlackForegroundColor,
BrightRedForegroundColorAttr: brightRedForegroundColorAttr, AttrBrightRedForegroundColor: attrBrightRedForegroundColor,
BrightGreenForegroundColorAttr: brightGreenForegroundColorAttr, AttrBrightGreenForegroundColor: attrBrightGreenForegroundColor,
BrightYellowForegroundColorAttr: brightYellowForegroundColorAttr, AttrBrightYellowForegroundColor: attrBrightYellowForegroundColor,
BrightBlueForegroundColorAttr: brightBlueForegroundColorAttr, AttrBrightBlueForegroundColor: attrBrightBlueForegroundColor,
BrightMagentaForegroundColorAttr: brightMagentaForegroundColorAttr, AttrBrightMagentaForegroundColor: attrBrightMagentaForegroundColor,
BrightCyanForegroundColorAttr: brightCyanForegroundColorAttr, AttrBrightCyanForegroundColor: attrBrightCyanForegroundColor,
BrightWhiteForegroundColorAttr: brightWhiteForegroundColorAttr, AttrBrightWhiteForegroundColor: attrBrightWhiteForegroundColor,
BrightBlackBackgroundColorAttr: brightBlackBackgroundColorAttr, AttrBrightBlackBackgroundColor: attrBrightBlackBackgroundColor,
BrightRedBackgroundColorAttr: brightRedBackgroundColorAttr, AttrBrightRedBackgroundColor: attrBrightRedBackgroundColor,
BrightGreenBackgroundColorAttr: brightGreenBackgroundColorAttr, AttrBrightGreenBackgroundColor: attrBrightGreenBackgroundColor,
BrightYellowBackgroundColorAttr: brightYellowBackgroundColorAttr, AttrBrightYellowBackgroundColor: attrBrightYellowBackgroundColor,
BrightBlueBackgroundColorAttr: brightBlueBackgroundColorAttr, AttrBrightBlueBackgroundColor: attrBrightBlueBackgroundColor,
BrightMagentaBackgroundColorAttr: brightMagentaBackgroundColorAttr, AttrBrightMagentaBackgroundColor: attrBrightMagentaBackgroundColor,
BrightCyanBackgroundColorAttr: brightCyanBackgroundColorAttr, AttrBrightCyanBackgroundColor: attrBrightCyanBackgroundColor,
BrightWhiteBackgroundColorAttr: brightWhiteBackgroundColorAttr, AttrBrightWhiteBackgroundColor: attrBrightWhiteBackgroundColor,
} }
+388 -242
View File
@@ -17,7 +17,9 @@ type Attr = int
// Style represents an ANSI SGR (Select Graphic Rendition) style. // Style represents an ANSI SGR (Select Graphic Rendition) style.
type Style []string type Style []string
// NewStyle returns a new style with the given attributes. // NewStyle returns a new style with the given attributes. Attributes are SGR
// (Select Graphic Rendition) codes that control text formatting like bold,
// italic, colors, etc.
func NewStyle(attrs ...Attr) Style { func NewStyle(attrs ...Attr) Style {
if len(attrs) == 0 { if len(attrs) == 0 {
return Style{} return Style{}
@@ -46,7 +48,8 @@ func (s Style) String() string {
return "\x1b[" + strings.Join(s, ";") + "m" return "\x1b[" + strings.Join(s, ";") + "m"
} }
// Styled returns a styled string with the given style applied. // Styled returns a styled string with the given style applied. The style is
// applied at the beginning and reset at the end of the string.
func (s Style) Styled(str string) string { func (s Style) Styled(str string) string {
if len(s) == 0 { if len(s) == 0 {
return str return str
@@ -54,309 +57,446 @@ func (s Style) Styled(str string) string {
return s.String() + str + ResetStyle return s.String() + str + ResetStyle
} }
// Reset appends the reset style attribute to the style. // Reset appends the reset style attribute to the style. This resets all
// formatting attributes to their defaults.
func (s Style) Reset() Style { func (s Style) Reset() Style {
return append(s, resetAttr) return append(s, attrReset)
} }
// Bold appends the bold style attribute to the style. // Bold appends the bold or normal intensity style attribute to the style.
// You can use [Style.Normal] to reset to normal intensity.
func (s Style) Bold() Style { func (s Style) Bold() Style {
return append(s, boldAttr) return append(s, attrBold)
} }
// Faint appends the faint style attribute to the style. // Faint appends the faint or normal intensity style attribute to the style.
// You can use [Style.Normal] to reset to normal intensity.
func (s Style) Faint() Style { func (s Style) Faint() Style {
return append(s, faintAttr) return append(s, attrFaint)
} }
// Italic appends the italic style attribute to the style. // Italic appends the italic or no italic style attribute to the style.
func (s Style) Italic() Style { // When v is true, text is rendered in italic. When false, italic is disabled.
return append(s, italicAttr) func (s Style) Italic(v bool) Style {
if v {
return append(s, attrItalic)
}
return append(s, attrNoItalic)
} }
// Underline appends the underline style attribute to the style. // Underline appends the underline or no underline style attribute to the style.
func (s Style) Underline() Style { // When v is true, text is underlined. When false, underline is disabled.
return append(s, underlineAttr) func (s Style) Underline(v bool) Style {
if v {
return append(s, attrUnderline)
}
return append(s, attrNoUnderline)
} }
// UnderlineStyle appends the underline style attribute to the style. // UnderlineStyle appends the underline style attribute to the style.
func (s Style) UnderlineStyle(u UnderlineStyle) Style { // Supports various underline styles including single, double, curly, dotted,
// and dashed.
func (s Style) UnderlineStyle(u Underline) Style {
switch u { switch u {
case NoUnderlineStyle: case UnderlineNone:
return s.NoUnderline() return s.Underline(false)
case SingleUnderlineStyle: case UnderlineSingle:
return s.Underline() return s.Underline(true)
case DoubleUnderlineStyle: case UnderlineDouble:
return append(s, doubleUnderlineStyle) return append(s, underlineDouble)
case CurlyUnderlineStyle: case UnderlineCurly:
return append(s, curlyUnderlineStyle) return append(s, underlineCurly)
case DottedUnderlineStyle: case UnderlineDotted:
return append(s, dottedUnderlineStyle) return append(s, underlineDotted)
case DashedUnderlineStyle: case UnderlineDashed:
return append(s, dashedUnderlineStyle) return append(s, underlineDashed)
} }
return s return s
} }
// DoubleUnderline appends the double underline style attribute to the style. // Blink appends the slow blink or no blink style attribute to the style.
// This is a convenience method for UnderlineStyle(DoubleUnderlineStyle). // When v is true, text blinks slowly (less than 150 per minute). When false,
func (s Style) DoubleUnderline() Style { // blinking is disabled.
return s.UnderlineStyle(DoubleUnderlineStyle) func (s Style) Blink(v bool) Style {
if v {
return append(s, attrBlink)
}
return append(s, attrNoBlink)
} }
// CurlyUnderline appends the curly underline style attribute to the style. // RapidBlink appends the rapid blink or no blink style attribute to the style.
// This is a convenience method for UnderlineStyle(CurlyUnderlineStyle). // When v is true, text blinks rapidly (150+ per minute). When false, blinking
func (s Style) CurlyUnderline() Style { // is disabled.
return s.UnderlineStyle(CurlyUnderlineStyle) //
// Note that this is not widely supported in terminal emulators.
func (s Style) RapidBlink(v bool) Style {
if v {
return append(s, attrRapidBlink)
}
return append(s, attrNoBlink)
} }
// DottedUnderline appends the dotted underline style attribute to the style. // Reverse appends the reverse or no reverse style attribute to the style.
// This is a convenience method for UnderlineStyle(DottedUnderlineStyle). // When v is true, foreground and background colors are swapped. When false,
func (s Style) DottedUnderline() Style { // reverse video is disabled.
return s.UnderlineStyle(DottedUnderlineStyle) func (s Style) Reverse(v bool) Style {
if v {
return append(s, attrReverse)
}
return append(s, attrNoReverse)
} }
// DashedUnderline appends the dashed underline style attribute to the style. // Conceal appends the conceal or no conceal style attribute to the style.
// This is a convenience method for UnderlineStyle(DashedUnderlineStyle). // When v is true, text is hidden/concealed. When false, concealment is
func (s Style) DashedUnderline() Style { // disabled.
return s.UnderlineStyle(DashedUnderlineStyle) func (s Style) Conceal(v bool) Style {
if v {
return append(s, attrConceal)
}
return append(s, attrNoConceal)
} }
// SlowBlink appends the slow blink style attribute to the style. // Strikethrough appends the strikethrough or no strikethrough style attribute
func (s Style) SlowBlink() Style { // to the style. When v is true, text is rendered with a horizontal line through
return append(s, slowBlinkAttr) // it. When false, strikethrough is disabled.
func (s Style) Strikethrough(v bool) Style {
if v {
return append(s, attrStrikethrough)
}
return append(s, attrNoStrikethrough)
} }
// RapidBlink appends the rapid blink style attribute to the style. // Normal appends the normal intensity style attribute to the style. This
func (s Style) RapidBlink() Style { // resets [Style.Bold] and [Style.Faint] attributes.
return append(s, rapidBlinkAttr) func (s Style) Normal() Style {
} return append(s, attrNormalIntensity)
// Reverse appends the reverse style attribute to the style.
func (s Style) Reverse() Style {
return append(s, reverseAttr)
}
// Conceal appends the conceal style attribute to the style.
func (s Style) Conceal() Style {
return append(s, concealAttr)
}
// Strikethrough appends the strikethrough style attribute to the style.
func (s Style) Strikethrough() Style {
return append(s, strikethroughAttr)
}
// NormalIntensity appends the normal intensity style attribute to the style.
func (s Style) NormalIntensity() Style {
return append(s, normalIntensityAttr)
} }
// NoItalic appends the no italic style attribute to the style. // NoItalic appends the no italic style attribute to the style.
//
// Deprecated: use [Style.Italic](false) instead.
func (s Style) NoItalic() Style { func (s Style) NoItalic() Style {
return append(s, noItalicAttr) return append(s, attrNoItalic)
} }
// NoUnderline appends the no underline style attribute to the style. // NoUnderline appends the no underline style attribute to the style.
//
// Deprecated: use [Style.Underline](false) instead.
func (s Style) NoUnderline() Style { func (s Style) NoUnderline() Style {
return append(s, noUnderlineAttr) return append(s, attrNoUnderline)
} }
// NoBlink appends the no blink style attribute to the style. // NoBlink appends the no blink style attribute to the style.
//
// Deprecated: use [Style.Blink](false) or [Style.RapidBlink](false) instead.
func (s Style) NoBlink() Style { func (s Style) NoBlink() Style {
return append(s, noBlinkAttr) return append(s, attrNoBlink)
} }
// NoReverse appends the no reverse style attribute to the style. // NoReverse appends the no reverse style attribute to the style.
//
// Deprecated: use [Style.Reverse](false) instead.
func (s Style) NoReverse() Style { func (s Style) NoReverse() Style {
return append(s, noReverseAttr) return append(s, attrNoReverse)
} }
// NoConceal appends the no conceal style attribute to the style. // NoConceal appends the no conceal style attribute to the style.
//
// Deprecated: use [Style.Conceal](false) instead.
func (s Style) NoConceal() Style { func (s Style) NoConceal() Style {
return append(s, noConcealAttr) return append(s, attrNoConceal)
} }
// NoStrikethrough appends the no strikethrough style attribute to the style. // NoStrikethrough appends the no strikethrough style attribute to the style.
//
// Deprecated: use [Style.Strikethrough](false) instead.
func (s Style) NoStrikethrough() Style { func (s Style) NoStrikethrough() Style {
return append(s, noStrikethroughAttr) return append(s, attrNoStrikethrough)
} }
// DefaultForegroundColor appends the default foreground color style attribute to the style. // DefaultForegroundColor appends the default foreground color style attribute to the style.
//
// Deprecated: use [Style.ForegroundColor](nil) instead.
func (s Style) DefaultForegroundColor() Style { func (s Style) DefaultForegroundColor() Style {
return append(s, defaultForegroundColorAttr) return append(s, attrDefaultForegroundColor)
} }
// DefaultBackgroundColor appends the default background color style attribute to the style. // DefaultBackgroundColor appends the default background color style attribute to the style.
//
// Deprecated: use [Style.BackgroundColor](nil) instead.
func (s Style) DefaultBackgroundColor() Style { func (s Style) DefaultBackgroundColor() Style {
return append(s, defaultBackgroundColorAttr) return append(s, attrDefaultBackgroundColor)
} }
// DefaultUnderlineColor appends the default underline color style attribute to the style. // DefaultUnderlineColor appends the default underline color style attribute to the style.
//
// Deprecated: use [Style.UnderlineColor](nil) instead.
func (s Style) DefaultUnderlineColor() Style { func (s Style) DefaultUnderlineColor() Style {
return append(s, defaultUnderlineColorAttr) return append(s, attrDefaultUnderlineColor)
} }
// ForegroundColor appends the foreground color style attribute to the style. // ForegroundColor appends the foreground color style attribute to the style.
// If c is nil, the default foreground color is used. Supports [BasicColor],
// [IndexedColor] (256-color), and [color.Color] (24-bit RGB).
func (s Style) ForegroundColor(c Color) Style { func (s Style) ForegroundColor(c Color) Style {
if c == nil {
return append(s, attrDefaultForegroundColor)
}
return append(s, foregroundColorString(c)) return append(s, foregroundColorString(c))
} }
// BackgroundColor appends the background color style attribute to the style. // BackgroundColor appends the background color style attribute to the style.
// If c is nil, the default background color is used. Supports [BasicColor],
// [IndexedColor] (256-color), and [color.Color] (24-bit RGB).
func (s Style) BackgroundColor(c Color) Style { func (s Style) BackgroundColor(c Color) Style {
if c == nil {
return append(s, attrDefaultBackgroundColor)
}
return append(s, backgroundColorString(c)) return append(s, backgroundColorString(c))
} }
// UnderlineColor appends the underline color style attribute to the style. // UnderlineColor appends the underline color style attribute to the style.
// If c is nil, the default underline color is used. Supports [BasicColor],
// [IndexedColor] (256-color), and [color.Color] (24-bit RGB).
func (s Style) UnderlineColor(c Color) Style { func (s Style) UnderlineColor(c Color) Style {
if c == nil {
return append(s, attrDefaultUnderlineColor)
}
return append(s, underlineColorString(c)) return append(s, underlineColorString(c))
} }
// Underline represents an ANSI SGR (Select Graphic Rendition) underline style.
type Underline = byte
// UnderlineStyle represents an ANSI SGR (Select Graphic Rendition) underline // UnderlineStyle represents an ANSI SGR (Select Graphic Rendition) underline
// style. // style.
//
// Deprecated: use [Underline] instead.
type UnderlineStyle = byte type UnderlineStyle = byte
const ( const (
doubleUnderlineStyle = "4:2" underlineDouble = "4:2"
curlyUnderlineStyle = "4:3" underlineCurly = "4:3"
dottedUnderlineStyle = "4:4" underlineDotted = "4:4"
dashedUnderlineStyle = "4:5" underlineDashed = "4:5"
) )
// Underline styles constants.
const ( const (
// NoUnderlineStyle is the default underline style. UnderlineNone Underline = iota
NoUnderlineStyle UnderlineStyle = iota UnderlineSingle
// SingleUnderlineStyle is a single underline style. UnderlineDouble
UnderlineCurly
UnderlineDotted
UnderlineDashed
)
// Underline styles constants.
//
// Deprecated: use [UnderlineNone], [UnderlineSingle], etc. instead.
const (
NoUnderlineStyle Underline = iota
SingleUnderlineStyle SingleUnderlineStyle
// DoubleUnderlineStyle is a double underline style.
DoubleUnderlineStyle DoubleUnderlineStyle
// CurlyUnderlineStyle is a curly underline style.
CurlyUnderlineStyle CurlyUnderlineStyle
// DottedUnderlineStyle is a dotted underline style.
DottedUnderlineStyle DottedUnderlineStyle
// DashedUnderlineStyle is a dashed underline style.
DashedUnderlineStyle DashedUnderlineStyle
) )
// Underline styles constants.
//
// Deprecated: use [UnderlineNone], [UnderlineSingle], etc. instead.
const (
UnderlineStyleNone Underline = iota
UnderlineStyleSingle
UnderlineStyleDouble
UnderlineStyleCurly
UnderlineStyleDotted
UnderlineStyleDashed
)
// SGR (Select Graphic Rendition) style attributes. // SGR (Select Graphic Rendition) style attributes.
// See: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters // See: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
const ( const (
ResetAttr Attr = 0 AttrReset Attr = 0
BoldAttr Attr = 1 AttrBold Attr = 1
FaintAttr Attr = 2 AttrFaint Attr = 2
ItalicAttr Attr = 3 AttrItalic Attr = 3
UnderlineAttr Attr = 4 AttrUnderline Attr = 4
SlowBlinkAttr Attr = 5 AttrBlink Attr = 5
RapidBlinkAttr Attr = 6 AttrRapidBlink Attr = 6
ReverseAttr Attr = 7 AttrReverse Attr = 7
ConcealAttr Attr = 8 AttrConceal Attr = 8
StrikethroughAttr Attr = 9 AttrStrikethrough Attr = 9
NormalIntensityAttr Attr = 22 AttrNormalIntensity Attr = 22
NoItalicAttr Attr = 23 AttrNoItalic Attr = 23
NoUnderlineAttr Attr = 24 AttrNoUnderline Attr = 24
NoBlinkAttr Attr = 25 AttrNoBlink Attr = 25
NoReverseAttr Attr = 27 AttrNoReverse Attr = 27
NoConcealAttr Attr = 28 AttrNoConceal Attr = 28
NoStrikethroughAttr Attr = 29 AttrNoStrikethrough Attr = 29
BlackForegroundColorAttr Attr = 30 AttrBlackForegroundColor Attr = 30
RedForegroundColorAttr Attr = 31 AttrRedForegroundColor Attr = 31
GreenForegroundColorAttr Attr = 32 AttrGreenForegroundColor Attr = 32
YellowForegroundColorAttr Attr = 33 AttrYellowForegroundColor Attr = 33
BlueForegroundColorAttr Attr = 34 AttrBlueForegroundColor Attr = 34
MagentaForegroundColorAttr Attr = 35 AttrMagentaForegroundColor Attr = 35
CyanForegroundColorAttr Attr = 36 AttrCyanForegroundColor Attr = 36
WhiteForegroundColorAttr Attr = 37 AttrWhiteForegroundColor Attr = 37
ExtendedForegroundColorAttr Attr = 38 AttrExtendedForegroundColor Attr = 38
DefaultForegroundColorAttr Attr = 39 AttrDefaultForegroundColor Attr = 39
BlackBackgroundColorAttr Attr = 40 AttrBlackBackgroundColor Attr = 40
RedBackgroundColorAttr Attr = 41 AttrRedBackgroundColor Attr = 41
GreenBackgroundColorAttr Attr = 42 AttrGreenBackgroundColor Attr = 42
YellowBackgroundColorAttr Attr = 43 AttrYellowBackgroundColor Attr = 43
BlueBackgroundColorAttr Attr = 44 AttrBlueBackgroundColor Attr = 44
MagentaBackgroundColorAttr Attr = 45 AttrMagentaBackgroundColor Attr = 45
CyanBackgroundColorAttr Attr = 46 AttrCyanBackgroundColor Attr = 46
WhiteBackgroundColorAttr Attr = 47 AttrWhiteBackgroundColor Attr = 47
ExtendedBackgroundColorAttr Attr = 48 AttrExtendedBackgroundColor Attr = 48
DefaultBackgroundColorAttr Attr = 49 AttrDefaultBackgroundColor Attr = 49
ExtendedUnderlineColorAttr Attr = 58 AttrExtendedUnderlineColor Attr = 58
DefaultUnderlineColorAttr Attr = 59 AttrDefaultUnderlineColor Attr = 59
BrightBlackForegroundColorAttr Attr = 90 AttrBrightBlackForegroundColor Attr = 90
BrightRedForegroundColorAttr Attr = 91 AttrBrightRedForegroundColor Attr = 91
BrightGreenForegroundColorAttr Attr = 92 AttrBrightGreenForegroundColor Attr = 92
BrightYellowForegroundColorAttr Attr = 93 AttrBrightYellowForegroundColor Attr = 93
BrightBlueForegroundColorAttr Attr = 94 AttrBrightBlueForegroundColor Attr = 94
BrightMagentaForegroundColorAttr Attr = 95 AttrBrightMagentaForegroundColor Attr = 95
BrightCyanForegroundColorAttr Attr = 96 AttrBrightCyanForegroundColor Attr = 96
BrightWhiteForegroundColorAttr Attr = 97 AttrBrightWhiteForegroundColor Attr = 97
BrightBlackBackgroundColorAttr Attr = 100 AttrBrightBlackBackgroundColor Attr = 100
BrightRedBackgroundColorAttr Attr = 101 AttrBrightRedBackgroundColor Attr = 101
BrightGreenBackgroundColorAttr Attr = 102 AttrBrightGreenBackgroundColor Attr = 102
BrightYellowBackgroundColorAttr Attr = 103 AttrBrightYellowBackgroundColor Attr = 103
BrightBlueBackgroundColorAttr Attr = 104 AttrBrightBlueBackgroundColor Attr = 104
BrightMagentaBackgroundColorAttr Attr = 105 AttrBrightMagentaBackgroundColor Attr = 105
BrightCyanBackgroundColorAttr Attr = 106 AttrBrightCyanBackgroundColor Attr = 106
BrightWhiteBackgroundColorAttr Attr = 107 AttrBrightWhiteBackgroundColor Attr = 107
RGBColorIntroducerAttr Attr = 2 AttrRGBColorIntroducer Attr = 2
ExtendedColorIntroducerAttr Attr = 5 AttrExtendedColorIntroducer Attr = 5
)
// SGR (Select Graphic Rendition) style attributes.
//
// Deprecated: use Attr* constants instead.
const (
ResetAttr = AttrReset
BoldAttr = AttrBold
FaintAttr = AttrFaint
ItalicAttr = AttrItalic
UnderlineAttr = AttrUnderline
SlowBlinkAttr = AttrBlink
RapidBlinkAttr = AttrRapidBlink
ReverseAttr = AttrReverse
ConcealAttr = AttrConceal
StrikethroughAttr = AttrStrikethrough
NormalIntensityAttr = AttrNormalIntensity
NoItalicAttr = AttrNoItalic
NoUnderlineAttr = AttrNoUnderline
NoBlinkAttr = AttrNoBlink
NoReverseAttr = AttrNoReverse
NoConcealAttr = AttrNoConceal
NoStrikethroughAttr = AttrNoStrikethrough
BlackForegroundColorAttr = AttrBlackForegroundColor
RedForegroundColorAttr = AttrRedForegroundColor
GreenForegroundColorAttr = AttrGreenForegroundColor
YellowForegroundColorAttr = AttrYellowForegroundColor
BlueForegroundColorAttr = AttrBlueForegroundColor
MagentaForegroundColorAttr = AttrMagentaForegroundColor
CyanForegroundColorAttr = AttrCyanForegroundColor
WhiteForegroundColorAttr = AttrWhiteForegroundColor
ExtendedForegroundColorAttr = AttrExtendedForegroundColor
DefaultForegroundColorAttr = AttrDefaultForegroundColor
BlackBackgroundColorAttr = AttrBlackBackgroundColor
RedBackgroundColorAttr = AttrRedBackgroundColor
GreenBackgroundColorAttr = AttrGreenBackgroundColor
YellowBackgroundColorAttr = AttrYellowBackgroundColor
BlueBackgroundColorAttr = AttrBlueBackgroundColor
MagentaBackgroundColorAttr = AttrMagentaBackgroundColor
CyanBackgroundColorAttr = AttrCyanBackgroundColor
WhiteBackgroundColorAttr = AttrWhiteBackgroundColor
ExtendedBackgroundColorAttr = AttrExtendedBackgroundColor
DefaultBackgroundColorAttr = AttrDefaultBackgroundColor
ExtendedUnderlineColorAttr = AttrExtendedUnderlineColor
DefaultUnderlineColorAttr = AttrDefaultUnderlineColor
BrightBlackForegroundColorAttr = AttrBrightBlackForegroundColor
BrightRedForegroundColorAttr = AttrBrightRedForegroundColor
BrightGreenForegroundColorAttr = AttrBrightGreenForegroundColor
BrightYellowForegroundColorAttr = AttrBrightYellowForegroundColor
BrightBlueForegroundColorAttr = AttrBrightBlueForegroundColor
BrightMagentaForegroundColorAttr = AttrBrightMagentaForegroundColor
BrightCyanForegroundColorAttr = AttrBrightCyanForegroundColor
BrightWhiteForegroundColorAttr = AttrBrightWhiteForegroundColor
BrightBlackBackgroundColorAttr = AttrBrightBlackBackgroundColor
BrightRedBackgroundColorAttr = AttrBrightRedBackgroundColor
BrightGreenBackgroundColorAttr = AttrBrightGreenBackgroundColor
BrightYellowBackgroundColorAttr = AttrBrightYellowBackgroundColor
BrightBlueBackgroundColorAttr = AttrBrightBlueBackgroundColor
BrightMagentaBackgroundColorAttr = AttrBrightMagentaBackgroundColor
BrightCyanBackgroundColorAttr = AttrBrightCyanBackgroundColor
BrightWhiteBackgroundColorAttr = AttrBrightWhiteBackgroundColor
RGBColorIntroducerAttr = AttrRGBColorIntroducer
ExtendedColorIntroducerAttr = AttrExtendedColorIntroducer
) )
const ( const (
resetAttr = "0" attrReset = "0"
boldAttr = "1" attrBold = "1"
faintAttr = "2" attrFaint = "2"
italicAttr = "3" attrItalic = "3"
underlineAttr = "4" attrUnderline = "4"
slowBlinkAttr = "5" attrBlink = "5"
rapidBlinkAttr = "6" attrRapidBlink = "6"
reverseAttr = "7" attrReverse = "7"
concealAttr = "8" attrConceal = "8"
strikethroughAttr = "9" attrStrikethrough = "9"
normalIntensityAttr = "22" attrNormalIntensity = "22"
noItalicAttr = "23" attrNoItalic = "23"
noUnderlineAttr = "24" attrNoUnderline = "24"
noBlinkAttr = "25" attrNoBlink = "25"
noReverseAttr = "27" attrNoReverse = "27"
noConcealAttr = "28" attrNoConceal = "28"
noStrikethroughAttr = "29" attrNoStrikethrough = "29"
blackForegroundColorAttr = "30" attrBlackForegroundColor = "30"
redForegroundColorAttr = "31" attrRedForegroundColor = "31"
greenForegroundColorAttr = "32" attrGreenForegroundColor = "32"
yellowForegroundColorAttr = "33" attrYellowForegroundColor = "33"
blueForegroundColorAttr = "34" attrBlueForegroundColor = "34"
magentaForegroundColorAttr = "35" attrMagentaForegroundColor = "35"
cyanForegroundColorAttr = "36" attrCyanForegroundColor = "36"
whiteForegroundColorAttr = "37" attrWhiteForegroundColor = "37"
extendedForegroundColorAttr = "38" attrExtendedForegroundColor = "38"
defaultForegroundColorAttr = "39" attrDefaultForegroundColor = "39"
blackBackgroundColorAttr = "40" attrBlackBackgroundColor = "40"
redBackgroundColorAttr = "41" attrRedBackgroundColor = "41"
greenBackgroundColorAttr = "42" attrGreenBackgroundColor = "42"
yellowBackgroundColorAttr = "43" attrYellowBackgroundColor = "43"
blueBackgroundColorAttr = "44" attrBlueBackgroundColor = "44"
magentaBackgroundColorAttr = "45" attrMagentaBackgroundColor = "45"
cyanBackgroundColorAttr = "46" attrCyanBackgroundColor = "46"
whiteBackgroundColorAttr = "47" attrWhiteBackgroundColor = "47"
extendedBackgroundColorAttr = "48" attrExtendedBackgroundColor = "48"
defaultBackgroundColorAttr = "49" attrDefaultBackgroundColor = "49"
extendedUnderlineColorAttr = "58" attrExtendedUnderlineColor = "58"
defaultUnderlineColorAttr = "59" attrDefaultUnderlineColor = "59"
brightBlackForegroundColorAttr = "90" attrBrightBlackForegroundColor = "90"
brightRedForegroundColorAttr = "91" attrBrightRedForegroundColor = "91"
brightGreenForegroundColorAttr = "92" attrBrightGreenForegroundColor = "92"
brightYellowForegroundColorAttr = "93" attrBrightYellowForegroundColor = "93"
brightBlueForegroundColorAttr = "94" attrBrightBlueForegroundColor = "94"
brightMagentaForegroundColorAttr = "95" attrBrightMagentaForegroundColor = "95"
brightCyanForegroundColorAttr = "96" attrBrightCyanForegroundColor = "96"
brightWhiteForegroundColorAttr = "97" attrBrightWhiteForegroundColor = "97"
brightBlackBackgroundColorAttr = "100" attrBrightBlackBackgroundColor = "100"
brightRedBackgroundColorAttr = "101" attrBrightRedBackgroundColor = "101"
brightGreenBackgroundColorAttr = "102" attrBrightGreenBackgroundColor = "102"
brightYellowBackgroundColorAttr = "103" attrBrightYellowBackgroundColor = "103"
brightBlueBackgroundColorAttr = "104" attrBrightBlueBackgroundColor = "104"
brightMagentaBackgroundColorAttr = "105" attrBrightMagentaBackgroundColor = "105"
brightCyanBackgroundColorAttr = "106" attrBrightCyanBackgroundColor = "106"
brightWhiteBackgroundColorAttr = "107" attrBrightWhiteBackgroundColor = "107"
) )
// foregroundColorString returns the style SGR attribute for the given // foregroundColorString returns the style SGR attribute for the given
@@ -364,42 +504,44 @@ const (
// See: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters // See: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
func foregroundColorString(c Color) string { func foregroundColorString(c Color) string {
switch c := c.(type) { switch c := c.(type) {
case nil:
return attrDefaultForegroundColor
case BasicColor: case BasicColor:
// 3-bit or 4-bit ANSI foreground // 3-bit or 4-bit ANSI foreground
// "3<n>" or "9<n>" where n is the color number from 0 to 7 // "3<n>" or "9<n>" where n is the color number from 0 to 7
switch c { switch c {
case Black: case Black:
return blackForegroundColorAttr return attrBlackForegroundColor
case Red: case Red:
return redForegroundColorAttr return attrRedForegroundColor
case Green: case Green:
return greenForegroundColorAttr return attrGreenForegroundColor
case Yellow: case Yellow:
return yellowForegroundColorAttr return attrYellowForegroundColor
case Blue: case Blue:
return blueForegroundColorAttr return attrBlueForegroundColor
case Magenta: case Magenta:
return magentaForegroundColorAttr return attrMagentaForegroundColor
case Cyan: case Cyan:
return cyanForegroundColorAttr return attrCyanForegroundColor
case White: case White:
return whiteForegroundColorAttr return attrWhiteForegroundColor
case BrightBlack: case BrightBlack:
return brightBlackForegroundColorAttr return attrBrightBlackForegroundColor
case BrightRed: case BrightRed:
return brightRedForegroundColorAttr return attrBrightRedForegroundColor
case BrightGreen: case BrightGreen:
return brightGreenForegroundColorAttr return attrBrightGreenForegroundColor
case BrightYellow: case BrightYellow:
return brightYellowForegroundColorAttr return attrBrightYellowForegroundColor
case BrightBlue: case BrightBlue:
return brightBlueForegroundColorAttr return attrBrightBlueForegroundColor
case BrightMagenta: case BrightMagenta:
return brightMagentaForegroundColorAttr return attrBrightMagentaForegroundColor
case BrightCyan: case BrightCyan:
return brightCyanForegroundColorAttr return attrBrightCyanForegroundColor
case BrightWhite: case BrightWhite:
return brightWhiteForegroundColorAttr return attrBrightWhiteForegroundColor
} }
case ExtendedColor: case ExtendedColor:
// 256-color ANSI foreground // 256-color ANSI foreground
@@ -414,7 +556,7 @@ func foregroundColorString(c Color) string {
strconv.FormatUint(uint64(shift(g)), 10) + ";" + strconv.FormatUint(uint64(shift(g)), 10) + ";" +
strconv.FormatUint(uint64(shift(b)), 10) strconv.FormatUint(uint64(shift(b)), 10)
} }
return defaultForegroundColorAttr return attrDefaultForegroundColor
} }
// backgroundColorString returns the style SGR attribute for the given // backgroundColorString returns the style SGR attribute for the given
@@ -422,42 +564,44 @@ func foregroundColorString(c Color) string {
// See: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters // See: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
func backgroundColorString(c Color) string { func backgroundColorString(c Color) string {
switch c := c.(type) { switch c := c.(type) {
case nil:
return attrDefaultBackgroundColor
case BasicColor: case BasicColor:
// 3-bit or 4-bit ANSI foreground // 3-bit or 4-bit ANSI foreground
// "4<n>" or "10<n>" where n is the color number from 0 to 7 // "4<n>" or "10<n>" where n is the color number from 0 to 7
switch c { switch c {
case Black: case Black:
return blackBackgroundColorAttr return attrBlackBackgroundColor
case Red: case Red:
return redBackgroundColorAttr return attrRedBackgroundColor
case Green: case Green:
return greenBackgroundColorAttr return attrGreenBackgroundColor
case Yellow: case Yellow:
return yellowBackgroundColorAttr return attrYellowBackgroundColor
case Blue: case Blue:
return blueBackgroundColorAttr return attrBlueBackgroundColor
case Magenta: case Magenta:
return magentaBackgroundColorAttr return attrMagentaBackgroundColor
case Cyan: case Cyan:
return cyanBackgroundColorAttr return attrCyanBackgroundColor
case White: case White:
return whiteBackgroundColorAttr return attrWhiteBackgroundColor
case BrightBlack: case BrightBlack:
return brightBlackBackgroundColorAttr return attrBrightBlackBackgroundColor
case BrightRed: case BrightRed:
return brightRedBackgroundColorAttr return attrBrightRedBackgroundColor
case BrightGreen: case BrightGreen:
return brightGreenBackgroundColorAttr return attrBrightGreenBackgroundColor
case BrightYellow: case BrightYellow:
return brightYellowBackgroundColorAttr return attrBrightYellowBackgroundColor
case BrightBlue: case BrightBlue:
return brightBlueBackgroundColorAttr return attrBrightBlueBackgroundColor
case BrightMagenta: case BrightMagenta:
return brightMagentaBackgroundColorAttr return attrBrightMagentaBackgroundColor
case BrightCyan: case BrightCyan:
return brightCyanBackgroundColorAttr return attrBrightCyanBackgroundColor
case BrightWhite: case BrightWhite:
return brightWhiteBackgroundColorAttr return attrBrightWhiteBackgroundColor
} }
case ExtendedColor: case ExtendedColor:
// 256-color ANSI foreground // 256-color ANSI foreground
@@ -472,7 +616,7 @@ func backgroundColorString(c Color) string {
strconv.FormatUint(uint64(shift(g)), 10) + ";" + strconv.FormatUint(uint64(shift(g)), 10) + ";" +
strconv.FormatUint(uint64(shift(b)), 10) strconv.FormatUint(uint64(shift(b)), 10)
} }
return defaultBackgroundColorAttr return attrDefaultBackgroundColor
} }
// underlineColorString returns the style SGR attribute for the given underline // underlineColorString returns the style SGR attribute for the given underline
@@ -480,6 +624,8 @@ func backgroundColorString(c Color) string {
// See: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters // See: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
func underlineColorString(c Color) string { func underlineColorString(c Color) string {
switch c := c.(type) { switch c := c.(type) {
case nil:
return attrDefaultUnderlineColor
// NOTE: we can't use 3-bit and 4-bit ANSI color codes with underline // NOTE: we can't use 3-bit and 4-bit ANSI color codes with underline
// color, use 256-color instead. // color, use 256-color instead.
// //
@@ -498,7 +644,7 @@ func underlineColorString(c Color) string {
strconv.FormatUint(uint64(shift(g)), 10) + ";" + strconv.FormatUint(uint64(shift(g)), 10) + ";" +
strconv.FormatUint(uint64(shift(b)), 10) strconv.FormatUint(uint64(shift(b)), 10)
} }
return defaultUnderlineColorAttr return attrDefaultUnderlineColor
} }
// ReadStyleColor decodes a color from a slice of parameters. It returns the // ReadStyleColor decodes a color from a slice of parameters. It returns the
@@ -526,7 +672,7 @@ func underlineColorString(c Color) string {
// 2. Support ignoring and omitting the color space id (second parameter) with respect to RGB colors // 2. Support ignoring and omitting the color space id (second parameter) with respect to RGB colors
// 3. Support ignoring and omitting the 6th parameter with respect to RGB and CMY colors // 3. Support ignoring and omitting the 6th parameter with respect to RGB and CMY colors
// 4. Support reading RGBA colors // 4. Support reading RGBA colors
func ReadStyleColor(params Params, co *color.Color) (n int) { func ReadStyleColor(params Params, co *color.Color) int {
if len(params) < 2 { // Need at least SGR type and color type if len(params) < 2 { // Need at least SGR type and color type
return 0 return 0
} }
@@ -535,7 +681,7 @@ func ReadStyleColor(params Params, co *color.Color) (n int) {
s := params[0] s := params[0]
p := params[1] p := params[1]
colorType := p.Param(0) colorType := p.Param(0)
n = 2 n := 2
paramsfn := func() (p1, p2, p3, p4 int) { paramsfn := func() (p1, p2, p3, p4 int) {
// Where should we start reading the color? // Where should we start reading the color?
@@ -594,7 +740,7 @@ func ReadStyleColor(params Params, co *color.Color) (n int) {
B: uint8(b), //nolint:gosec B: uint8(b), //nolint:gosec
A: 0xff, A: 0xff,
} }
return //nolint:nakedret return n
case 3: // CMY direct color case 3: // CMY direct color
if len(params) < 5 { if len(params) < 5 {
@@ -612,7 +758,7 @@ func ReadStyleColor(params Params, co *color.Color) (n int) {
Y: uint8(y), //nolint:gosec Y: uint8(y), //nolint:gosec
K: 0, K: 0,
} }
return //nolint:nakedret return n
case 4: // CMYK direct color case 4: // CMYK direct color
if len(params) < 6 { if len(params) < 6 {
@@ -630,7 +776,7 @@ func ReadStyleColor(params Params, co *color.Color) (n int) {
Y: uint8(y), //nolint:gosec Y: uint8(y), //nolint:gosec
K: uint8(k), //nolint:gosec K: uint8(k), //nolint:gosec
} }
return //nolint:nakedret return n
case 5: // indexed color case 5: // indexed color
if len(params) < 3 { if len(params) < 3 {
@@ -665,7 +811,7 @@ func ReadStyleColor(params Params, co *color.Color) (n int) {
B: uint8(b), //nolint:gosec B: uint8(b), //nolint:gosec
A: uint8(a), //nolint:gosec A: uint8(a), //nolint:gosec
} }
return //nolint:nakedret return n
default: default:
return 0 return 0
+24 -33
View File
@@ -1,11 +1,11 @@
package ansi package ansi
import ( import (
"bytes" "strings"
"github.com/charmbracelet/x/ansi/parser" "github.com/charmbracelet/x/ansi/parser"
"github.com/mattn/go-runewidth" "github.com/clipperhouse/displaywidth"
"github.com/rivo/uniseg" "github.com/clipperhouse/uax29/v2/graphemes"
) )
// Cut the string, without adding any prefix or tail strings. This function is // Cut the string, without adding any prefix or tail strings. This function is
@@ -74,12 +74,11 @@ func truncate(m Method, s string, length int, tail string) string {
return "" return ""
} }
var cluster []byte var cluster string
var buf bytes.Buffer var buf strings.Builder
curWidth := 0 curWidth := 0
ignoring := false ignoring := false
pstate := parser.GroundState // initial state pstate := parser.GroundState // initial state
b := []byte(s)
i := 0 i := 0
// Here we iterate over the bytes of the string and collect printable // Here we iterate over the bytes of the string and collect printable
@@ -88,16 +87,12 @@ func truncate(m Method, s string, length int, tail string) string {
// //
// Once we reach the given length, we start ignoring characters and only // Once we reach the given length, we start ignoring characters and only
// collect ANSI escape codes until we reach the end of string. // collect ANSI escape codes until we reach the end of string.
for i < len(b) { for i < len(s) {
state, action := parser.Table.Transition(pstate, b[i]) state, action := parser.Table.Transition(pstate, s[i])
if state == parser.Utf8State { if state == parser.Utf8State {
// This action happens when we transition to the Utf8State. // This action happens when we transition to the Utf8State.
var width int var width int
cluster, _, width, _ = uniseg.FirstGraphemeCluster(b[i:], -1) cluster, width = FirstGraphemeCluster(s[i:], m)
if m == WcWidth {
width = runewidth.StringWidth(string(cluster))
}
// increment the index by the length of the cluster // increment the index by the length of the cluster
i += len(cluster) i += len(cluster)
curWidth += width curWidth += width
@@ -118,7 +113,7 @@ func truncate(m Method, s string, length int, tail string) string {
continue continue
} }
buf.Write(cluster) buf.WriteString(cluster)
// Done collecting, now we're back in the ground state. // Done collecting, now we're back in the ground state.
pstate = parser.GroundState pstate = parser.GroundState
@@ -152,7 +147,7 @@ func truncate(m Method, s string, length int, tail string) string {
} }
fallthrough fallthrough
default: default:
buf.WriteByte(b[i]) buf.WriteByte(s[i])
i++ i++
} }
@@ -193,27 +188,23 @@ func truncateLeft(m Method, s string, n int, prefix string) string {
return s return s
} }
var cluster []byte var cluster string
var buf bytes.Buffer var buf strings.Builder
curWidth := 0 curWidth := 0
ignoring := true ignoring := true
pstate := parser.GroundState pstate := parser.GroundState
b := []byte(s)
i := 0 i := 0
for i < len(b) { for i < len(s) {
if !ignoring { if !ignoring {
buf.Write(b[i:]) buf.WriteString(s[i:])
break break
} }
state, action := parser.Table.Transition(pstate, b[i]) state, action := parser.Table.Transition(pstate, s[i])
if state == parser.Utf8State { if state == parser.Utf8State {
var width int var width int
cluster, _, width, _ = uniseg.FirstGraphemeCluster(b[i:], -1) cluster, width = FirstGraphemeCluster(s[i:], m)
if m == WcWidth {
width = runewidth.StringWidth(string(cluster))
}
i += len(cluster) i += len(cluster)
curWidth += width curWidth += width
@@ -224,7 +215,7 @@ func truncateLeft(m Method, s string, n int, prefix string) string {
} }
if curWidth > n { if curWidth > n {
buf.Write(cluster) buf.WriteString(cluster)
} }
if ignoring { if ignoring {
@@ -259,7 +250,7 @@ func truncateLeft(m Method, s string, n int, prefix string) string {
} }
fallthrough fallthrough
default: default:
buf.WriteByte(b[i]) buf.WriteByte(s[i])
i++ i++
} }
@@ -278,22 +269,22 @@ func truncateLeft(m Method, s string, n int, prefix string) string {
// You can use this with [Truncate], [TruncateLeft], and [Cut]. // You can use this with [Truncate], [TruncateLeft], and [Cut].
func ByteToGraphemeRange(str string, byteStart, byteStop int) (charStart, charStop int) { func ByteToGraphemeRange(str string, byteStart, byteStop int) (charStart, charStop int) {
bytePos, charPos := 0, 0 bytePos, charPos := 0, 0
gr := uniseg.NewGraphemes(str) gr := graphemes.FromString(str)
for byteStart > bytePos { for byteStart > bytePos {
if !gr.Next() { if !gr.Next() {
break break
} }
bytePos += len(gr.Str()) bytePos += len(gr.Value())
charPos += max(1, gr.Width()) charPos += max(1, displaywidth.String(gr.Value()))
} }
charStart = charPos charStart = charPos
for byteStop > bytePos { for byteStop > bytePos {
if !gr.Next() { if !gr.Next() {
break break
} }
bytePos += len(gr.Str()) bytePos += len(gr.Value())
charPos += max(1, gr.Width()) charPos += max(1, displaywidth.String(gr.Value()))
} }
charStop = charPos charStop = charPos
return return charStart, charStop
} }
+17
View File
@@ -0,0 +1,17 @@
package ansi
import (
"fmt"
"strings"
)
// URxvtExt returns an escape sequence for calling a URxvt perl extension with
// the given name and parameters.
//
// OSC 777 ; extension_name ; param1 ; param2 ; ... ST
// OSC 777 ; extension_name ; param1 ; param2 ; ... BEL
//
// See: https://man.archlinux.org/man/extra/rxvt-unicode/urxvt.7.en#XTerm_Operating_System_Commands
func URxvtExt(extension string, params ...string) string {
return fmt.Sprintf("\x1b]777;%s;%s\x07", extension, strings.Join(params, ";"))
}
+4 -10
View File
@@ -4,8 +4,6 @@ import (
"bytes" "bytes"
"github.com/charmbracelet/x/ansi/parser" "github.com/charmbracelet/x/ansi/parser"
"github.com/mattn/go-runewidth"
"github.com/rivo/uniseg"
) )
// Strip removes ANSI escape codes from a string. // Strip removes ANSI escape codes from a string.
@@ -83,20 +81,16 @@ func stringWidth(m Method, s string) int {
} }
var ( var (
pstate = parser.GroundState // initial state pstate = parser.GroundState // initial state
cluster string width int
width int
) )
for i := 0; i < len(s); i++ { for i := 0; i < len(s); i++ {
state, action := parser.Table.Transition(pstate, s[i]) state, action := parser.Table.Transition(pstate, s[i])
if state == parser.Utf8State { if state == parser.Utf8State {
var w int cluster, w := FirstGraphemeCluster(s[i:], m)
cluster, _, w, _ = uniseg.FirstGraphemeClusterInString(s[i:], -1)
if m == WcWidth {
w = runewidth.StringWidth(cluster)
}
width += w width += w
i += len(cluster) - 1 i += len(cluster) - 1
pstate = parser.GroundState pstate = parser.GroundState
continue continue
+24 -26
View File
@@ -2,12 +2,11 @@ package ansi
import ( import (
"bytes" "bytes"
"strings"
"unicode" "unicode"
"unicode/utf8" "unicode/utf8"
"github.com/charmbracelet/x/ansi/parser" "github.com/charmbracelet/x/ansi/parser"
"github.com/mattn/go-runewidth"
"github.com/rivo/uniseg"
) )
// nbsp is a non-breaking space. // nbsp is a non-breaking space.
@@ -55,12 +54,9 @@ func hardwrap(m Method, s string, limit int, preserveSpace bool) string {
i := 0 i := 0
for i < len(b) { for i < len(b) {
state, action := parser.Table.Transition(pstate, b[i]) state, action := parser.Table.Transition(pstate, b[i])
if state == parser.Utf8State { //nolint:nestif if state == parser.Utf8State {
var width int var width int
cluster, _, width, _ = uniseg.FirstGraphemeCluster(b[i:], -1) cluster, width = FirstGraphemeCluster(b[i:], m)
if m == WcWidth {
width = runewidth.StringWidth(string(cluster))
}
i += len(cluster) i += len(cluster)
if curWidth+width > limit { if curWidth+width > limit {
@@ -192,10 +188,7 @@ func wordwrap(m Method, s string, limit int, breakpoints string) string {
state, action := parser.Table.Transition(pstate, b[i]) state, action := parser.Table.Transition(pstate, b[i])
if state == parser.Utf8State { //nolint:nestif if state == parser.Utf8State { //nolint:nestif
var width int var width int
cluster, _, width, _ = uniseg.FirstGraphemeCluster(b[i:], -1) cluster, width = FirstGraphemeCluster(b[i:], m)
if m == WcWidth {
width = runewidth.StringWidth(string(cluster))
}
i += len(cluster) i += len(cluster)
r, _ := utf8.DecodeRune(cluster) r, _ := utf8.DecodeRune(cluster)
@@ -303,7 +296,7 @@ func wrap(m Method, s string, limit int, breakpoints string) string {
} }
var ( var (
cluster []byte cluster string
buf bytes.Buffer buf bytes.Buffer
word bytes.Buffer word bytes.Buffer
space bytes.Buffer space bytes.Buffer
@@ -311,10 +304,12 @@ func wrap(m Method, s string, limit int, breakpoints string) string {
curWidth int // written width of the line curWidth int // written width of the line
wordLen int // word buffer len without ANSI escape codes wordLen int // word buffer len without ANSI escape codes
pstate = parser.GroundState // initial state pstate = parser.GroundState // initial state
b = []byte(s)
) )
addSpace := func() { addSpace := func() {
if spaceWidth == 0 && space.Len() == 0 {
return
}
curWidth += spaceWidth curWidth += spaceWidth
buf.Write(space.Bytes()) buf.Write(space.Bytes())
space.Reset() space.Reset()
@@ -341,30 +336,27 @@ func wrap(m Method, s string, limit int, breakpoints string) string {
} }
i := 0 i := 0
for i < len(b) { for i < len(s) {
state, action := parser.Table.Transition(pstate, b[i]) state, action := parser.Table.Transition(pstate, s[i])
if state == parser.Utf8State { //nolint:nestif if state == parser.Utf8State { //nolint:nestif
var width int var width int
cluster, _, width, _ = uniseg.FirstGraphemeCluster(b[i:], -1) cluster, width = FirstGraphemeCluster(s[i:], m)
if m == WcWidth {
width = runewidth.StringWidth(string(cluster))
}
i += len(cluster) i += len(cluster)
r, _ := utf8.DecodeRune(cluster) r, _ := utf8.DecodeRuneInString(cluster)
switch { switch {
case r != utf8.RuneError && unicode.IsSpace(r) && r != nbsp: // nbsp is a non-breaking space case r != utf8.RuneError && unicode.IsSpace(r) && r != nbsp: // nbsp is a non-breaking space
addWord() addWord()
space.WriteRune(r) space.WriteRune(r)
spaceWidth += width spaceWidth += width
case bytes.ContainsAny(cluster, breakpoints): case strings.ContainsAny(cluster, breakpoints):
addSpace() addSpace()
if curWidth+wordLen+width > limit { if curWidth+wordLen+width > limit {
word.Write(cluster) word.WriteString(cluster)
wordLen += width wordLen += width
} else { } else {
addWord() addWord()
buf.Write(cluster) buf.WriteString(cluster)
curWidth += width curWidth += width
} }
default: default:
@@ -373,12 +365,17 @@ func wrap(m Method, s string, limit int, breakpoints string) string {
addWord() addWord()
} }
word.Write(cluster) word.WriteString(cluster)
wordLen += width wordLen += width
if curWidth+wordLen+spaceWidth > limit { if curWidth+wordLen+spaceWidth > limit {
addNewline() addNewline()
} }
if wordLen == limit {
// Hardwrap the word if it's too long
addWord()
}
} }
pstate = parser.GroundState pstate = parser.GroundState
@@ -387,7 +384,7 @@ func wrap(m Method, s string, limit int, breakpoints string) string {
switch action { switch action {
case parser.PrintAction, parser.ExecuteAction: case parser.PrintAction, parser.ExecuteAction:
switch r := rune(b[i]); { switch r := rune(s[i]); {
case r == '\n': case r == '\n':
if wordLen == 0 { if wordLen == 0 {
if curWidth+spaceWidth > limit { if curWidth+spaceWidth > limit {
@@ -424,6 +421,7 @@ func wrap(m Method, s string, limit int, breakpoints string) string {
if curWidth == limit { if curWidth == limit {
addNewline() addNewline()
} }
word.WriteRune(r) word.WriteRune(r)
wordLen++ wordLen++
@@ -438,7 +436,7 @@ func wrap(m Method, s string, limit int, breakpoints string) string {
} }
default: default:
word.WriteByte(b[i]) word.WriteByte(s[i])
} }
// We manage the UTF8 state separately manually above. // We manage the UTF8 state separately manually above.
+8 -7
View File
@@ -1,3 +1,4 @@
// Package cellbuf provides terminal cell buffer functionality.
package cellbuf package cellbuf
import ( import (
@@ -24,7 +25,7 @@ func NewCell(r rune, comb ...rune) (c *Cell) {
} }
c.Comb = comb c.Comb = comb
c.Width = runewidth.StringWidth(string(append([]rune{r}, comb...))) c.Width = runewidth.StringWidth(string(append([]rune{r}, comb...)))
return return c
} }
// NewCellString returns a new cell with the given string content. This is a // NewCellString returns a new cell with the given string content. This is a
@@ -46,7 +47,7 @@ func NewCellString(s string) (c *Cell) {
c.Comb = append(c.Comb, r) c.Comb = append(c.Comb, r)
} }
} }
return return c
} }
// NewGraphemeCell returns a new cell. This is a convenience function that // NewGraphemeCell returns a new cell. This is a convenience function that
@@ -71,7 +72,7 @@ func newGraphemeCell(s string, w int) (c *Cell) {
c.Comb = append(c.Comb, r) c.Comb = append(c.Comb, r)
} }
} }
return return c
} }
// Line represents a line in the terminal. // Line represents a line in the terminal.
@@ -104,7 +105,7 @@ func (l Line) String() (s string) {
} }
} }
s = strings.TrimRight(s, " ") s = strings.TrimRight(s, " ")
return return s
} }
// At returns the cell at the given x position. // At returns the cell at the given x position.
@@ -150,7 +151,7 @@ func (l Line) set(x int, c *Cell, clone bool) bool {
for j := 1; j < maxCellWidth && x-j >= 0; j++ { for j := 1; j < maxCellWidth && x-j >= 0; j++ {
wide := l.At(x - j) wide := l.At(x - j)
if wide != nil && wide.Width > 1 && j < wide.Width { if wide != nil && wide.Width > 1 && j < wide.Width {
for k := 0; k < wide.Width; k++ { for k := range wide.Width {
l[x-j+k] = wide.Clone().Blank() l[x-j+k] = wide.Clone().Blank()
} }
break break
@@ -206,7 +207,7 @@ func (b *Buffer) String() (s string) {
s += "\r\n" s += "\r\n"
} }
} }
return return s
} }
// Line returns a pointer to the line at the given y position. // Line returns a pointer to the line at the given y position.
@@ -296,7 +297,7 @@ func (b *Buffer) FillRect(c *Cell, rect Rectangle) {
} }
for y := rect.Min.Y; y < rect.Max.Y; y++ { for y := rect.Min.Y; y < rect.Max.Y; y++ {
for x := rect.Min.X; x < rect.Max.X; x += cellWidth { for x := rect.Min.X; x < rect.Max.X; x += cellWidth {
b.setCell(x, y, c, false) //nolint:errcheck b.setCell(x, y, c, false)
} }
} }
} }
+31 -52
View File
@@ -96,7 +96,7 @@ func (c *Cell) Clear() bool {
func (c *Cell) Clone() (n *Cell) { func (c *Cell) Clone() (n *Cell) {
n = new(Cell) n = new(Cell)
*n = *c *n = *c
return return n
} }
// Blank makes the cell a blank cell by setting the rune to a space, comb to // Blank makes the cell a blank cell by setting the rune to a space, comb to
@@ -164,12 +164,12 @@ type UnderlineStyle = ansi.UnderlineStyle
// These are the available underline styles. // These are the available underline styles.
const ( const (
NoUnderline = ansi.NoUnderlineStyle NoUnderline = ansi.UnderlineStyleNone
SingleUnderline = ansi.SingleUnderlineStyle SingleUnderline = ansi.UnderlineStyleSingle
DoubleUnderline = ansi.DoubleUnderlineStyle DoubleUnderline = ansi.UnderlineStyleDouble
CurlyUnderline = ansi.CurlyUnderlineStyle CurlyUnderline = ansi.UnderlineStyleCurly
DottedUnderline = ansi.DottedUnderlineStyle DottedUnderline = ansi.UnderlineStyleDotted
DashedUnderline = ansi.DashedUnderlineStyle DashedUnderline = ansi.UnderlineStyleDashed
) )
// Style represents the Style of a cell. // Style represents the Style of a cell.
@@ -189,7 +189,7 @@ func (s Style) Sequence() string {
var b ansi.Style var b ansi.Style
if s.Attrs != 0 { if s.Attrs != 0 { //nolint:nestif
if s.Attrs&BoldAttr != 0 { if s.Attrs&BoldAttr != 0 {
b = b.Bold() b = b.Bold()
} }
@@ -197,36 +197,31 @@ func (s Style) Sequence() string {
b = b.Faint() b = b.Faint()
} }
if s.Attrs&ItalicAttr != 0 { if s.Attrs&ItalicAttr != 0 {
b = b.Italic() b = b.Italic(true)
} }
if s.Attrs&SlowBlinkAttr != 0 { if s.Attrs&SlowBlinkAttr != 0 {
b = b.SlowBlink() b = b.Blink(true)
} }
if s.Attrs&RapidBlinkAttr != 0 { if s.Attrs&RapidBlinkAttr != 0 {
b = b.RapidBlink() b = b.RapidBlink(true)
} }
if s.Attrs&ReverseAttr != 0 { if s.Attrs&ReverseAttr != 0 {
b = b.Reverse() b = b.Reverse(true)
} }
if s.Attrs&ConcealAttr != 0 { if s.Attrs&ConcealAttr != 0 {
b = b.Conceal() b = b.Conceal(true)
} }
if s.Attrs&StrikethroughAttr != 0 { if s.Attrs&StrikethroughAttr != 0 {
b = b.Strikethrough() b = b.Strikethrough(true)
} }
} }
if s.UlStyle != NoUnderline { if s.UlStyle != NoUnderline {
switch s.UlStyle { switch u := s.UlStyle; u {
case SingleUnderline: case NoUnderline:
b = b.Underline() b = b.Underline(false)
case DoubleUnderline: default:
b = b.DoubleUnderline() b = b.Underline(true)
case CurlyUnderline: b = b.UnderlineStyle(u)
b = b.CurlyUnderline()
case DottedUnderline:
b = b.DottedUnderline()
case DashedUnderline:
b = b.DashedUnderline()
} }
} }
if s.Fg != nil { if s.Fg != nil {
@@ -268,64 +263,48 @@ func (s Style) DiffSequence(o Style) string {
isNormal bool isNormal bool
) )
if s.Attrs != o.Attrs { if s.Attrs != o.Attrs { //nolint:nestif
if s.Attrs&BoldAttr != o.Attrs&BoldAttr { if s.Attrs&BoldAttr != o.Attrs&BoldAttr {
if s.Attrs&BoldAttr != 0 { if s.Attrs&BoldAttr != 0 {
b = b.Bold() b = b.Bold()
} else if !isNormal { } else if !isNormal {
isNormal = true isNormal = true
b = b.NormalIntensity() b = b.Normal()
} }
} }
if s.Attrs&FaintAttr != o.Attrs&FaintAttr { if s.Attrs&FaintAttr != o.Attrs&FaintAttr {
if s.Attrs&FaintAttr != 0 { if s.Attrs&FaintAttr != 0 {
b = b.Faint() b = b.Faint()
} else if !isNormal { } else if !isNormal {
b = b.NormalIntensity() b = b.Normal()
} }
} }
if s.Attrs&ItalicAttr != o.Attrs&ItalicAttr { if s.Attrs&ItalicAttr != o.Attrs&ItalicAttr {
if s.Attrs&ItalicAttr != 0 { b = b.Italic(s.Attrs&ItalicAttr != 0)
b = b.Italic()
} else {
b = b.NoItalic()
}
} }
if s.Attrs&SlowBlinkAttr != o.Attrs&SlowBlinkAttr { if s.Attrs&SlowBlinkAttr != o.Attrs&SlowBlinkAttr {
if s.Attrs&SlowBlinkAttr != 0 { if s.Attrs&SlowBlinkAttr != 0 {
b = b.SlowBlink() b = b.Blink(true)
} else if !noBlink { } else if !noBlink {
noBlink = true noBlink = true
b = b.NoBlink() b = b.Blink(false)
} }
} }
if s.Attrs&RapidBlinkAttr != o.Attrs&RapidBlinkAttr { if s.Attrs&RapidBlinkAttr != o.Attrs&RapidBlinkAttr {
if s.Attrs&RapidBlinkAttr != 0 { if s.Attrs&RapidBlinkAttr != 0 {
b = b.RapidBlink() b = b.RapidBlink(true)
} else if !noBlink { } else if !noBlink {
b = b.NoBlink() b = b.Blink(false)
} }
} }
if s.Attrs&ReverseAttr != o.Attrs&ReverseAttr { if s.Attrs&ReverseAttr != o.Attrs&ReverseAttr {
if s.Attrs&ReverseAttr != 0 { b = b.Reverse(s.Attrs&ReverseAttr != 0)
b = b.Reverse()
} else {
b = b.NoReverse()
}
} }
if s.Attrs&ConcealAttr != o.Attrs&ConcealAttr { if s.Attrs&ConcealAttr != o.Attrs&ConcealAttr {
if s.Attrs&ConcealAttr != 0 { b = b.Conceal(s.Attrs&ConcealAttr != 0)
b = b.Conceal()
} else {
b = b.NoConceal()
}
} }
if s.Attrs&StrikethroughAttr != o.Attrs&StrikethroughAttr { if s.Attrs&StrikethroughAttr != o.Attrs&StrikethroughAttr {
if s.Attrs&StrikethroughAttr != 0 { b = b.Strikethrough(s.Attrs&StrikethroughAttr != 0)
b = b.Strikethrough()
} else {
b = b.NoStrikethrough()
}
} }
} }
+1 -1
View File
@@ -12,7 +12,7 @@ func Pos(x, y int) Position {
return image.Pt(x, y) return image.Pt(x, y)
} }
// Rectange represents a rectangle. // Rectangle represents a rectangle.
type Rectangle = image.Rectangle type Rectangle = image.Rectangle
// Rect is a shorthand for Rectangle. // Rect is a shorthand for Rectangle.
+10 -9
View File
@@ -75,7 +75,7 @@ func (s *Screen) scrolln(n, top, bot, maxY int) (v bool) { //nolint:unparam
) )
blank := s.clearBlank() blank := s.clearBlank()
if n > 0 { if n > 0 { //nolint:nestif
// Scroll up (forward) // Scroll up (forward)
v = s.scrollUp(n, top, bot, 0, maxY, blank) v = s.scrollUp(n, top, bot, 0, maxY, blank)
if !v { if !v {
@@ -99,7 +99,7 @@ func (s *Screen) scrolln(n, top, bot, maxY int) (v bool) { //nolint:unparam
s.move(0, bot-n+1) s.move(0, bot-n+1)
s.clearToBottom(nil) s.clearToBottom(nil)
} else { } else {
for i := 0; i < n; i++ { for i := range n {
s.move(0, bot-i) s.move(0, bot-i)
s.clearToEnd(nil, false) s.clearToEnd(nil, false)
} }
@@ -124,7 +124,7 @@ func (s *Screen) scrolln(n, top, bot, maxY int) (v bool) { //nolint:unparam
// Clear newly shifted-in lines. // Clear newly shifted-in lines.
if v && if v &&
(nonDestScrollRegion || (memoryBelow && top == 0)) { (nonDestScrollRegion || (memoryBelow && top == 0)) {
for i := 0; i < -n; i++ { for i := range -n {
s.move(0, top+i) s.move(0, top+i)
s.clearToEnd(nil, false) s.clearToEnd(nil, false)
} }
@@ -133,7 +133,7 @@ func (s *Screen) scrolln(n, top, bot, maxY int) (v bool) { //nolint:unparam
} }
if !v { if !v {
return return v
} }
s.scrollBuffer(s.curbuf, n, top, bot, blank) s.scrollBuffer(s.curbuf, n, top, bot, blank)
@@ -193,7 +193,7 @@ func (s *Screen) touchLine(width, height, y, n int, changed bool) {
// scrollUp scrolls the screen up by n lines. // scrollUp scrolls the screen up by n lines.
func (s *Screen) scrollUp(n, top, bot, minY, maxY int, blank *Cell) bool { func (s *Screen) scrollUp(n, top, bot, minY, maxY int, blank *Cell) bool {
if n == 1 && top == minY && bot == maxY { if n == 1 && top == minY && bot == maxY { //nolint:nestif
s.move(0, bot) s.move(0, bot)
s.updatePen(blank) s.updatePen(blank)
s.buf.WriteByte('\n') s.buf.WriteByte('\n')
@@ -202,13 +202,14 @@ func (s *Screen) scrollUp(n, top, bot, minY, maxY int, blank *Cell) bool {
s.updatePen(blank) s.updatePen(blank)
s.buf.WriteString(ansi.DeleteLine(1)) s.buf.WriteString(ansi.DeleteLine(1))
} else if top == minY && bot == maxY { } else if top == minY && bot == maxY {
if s.xtermLike { supportsSU := s.caps.Contains(capSU)
if supportsSU {
s.move(0, bot) s.move(0, bot)
} else { } else {
s.move(0, top) s.move(0, top)
} }
s.updatePen(blank) s.updatePen(blank)
if s.xtermLike { if supportsSU {
s.buf.WriteString(ansi.ScrollUp(n)) s.buf.WriteString(ansi.ScrollUp(n))
} else { } else {
s.buf.WriteString(strings.Repeat("\n", n)) s.buf.WriteString(strings.Repeat("\n", n))
@@ -225,7 +226,7 @@ func (s *Screen) scrollUp(n, top, bot, minY, maxY int, blank *Cell) bool {
// scrollDown scrolls the screen down by n lines. // scrollDown scrolls the screen down by n lines.
func (s *Screen) scrollDown(n, top, bot, minY, maxY int, blank *Cell) bool { func (s *Screen) scrollDown(n, top, bot, minY, maxY int, blank *Cell) bool {
if n == 1 && top == minY && bot == maxY { if n == 1 && top == minY && bot == maxY { //nolint:nestif
s.move(0, top) s.move(0, top)
s.updatePen(blank) s.updatePen(blank)
s.buf.WriteString(ansi.ReverseIndex) s.buf.WriteString(ansi.ReverseIndex)
@@ -236,7 +237,7 @@ func (s *Screen) scrollDown(n, top, bot, minY, maxY int, blank *Cell) bool {
} else if top == minY && bot == maxY { } else if top == minY && bot == maxY {
s.move(0, top) s.move(0, top)
s.updatePen(blank) s.updatePen(blank)
if s.xtermLike { if s.caps.Contains(capSD) {
s.buf.WriteString(ansi.ScrollDown(n)) s.buf.WriteString(ansi.ScrollDown(n))
} else { } else {
s.buf.WriteString(strings.Repeat(ansi.ReverseIndex, n)) s.buf.WriteString(strings.Repeat(ansi.ReverseIndex, n))
+8 -8
View File
@@ -15,7 +15,7 @@ func hash(l Line) (h uint64) {
} }
h += (h << 5) + uint64(r) h += (h << 5) + uint64(r)
} }
return return h
} }
// hashmap represents a single [Line] hash. // hashmap represents a single [Line] hash.
@@ -33,7 +33,7 @@ func (s *Screen) updateHashmap() {
height := s.newbuf.Height() height := s.newbuf.Height()
if len(s.oldhash) >= height && len(s.newhash) >= height { if len(s.oldhash) >= height && len(s.newhash) >= height {
// rehash changed lines // rehash changed lines
for i := 0; i < height; i++ { for i := range height {
_, ok := s.touch[i] _, ok := s.touch[i]
if ok { if ok {
s.oldhash[i] = hash(s.curbuf.Line(i)) s.oldhash[i] = hash(s.curbuf.Line(i))
@@ -48,14 +48,14 @@ func (s *Screen) updateHashmap() {
if len(s.newhash) != height { if len(s.newhash) != height {
s.newhash = make([]uint64, height) s.newhash = make([]uint64, height)
} }
for i := 0; i < height; i++ { for i := range height {
s.oldhash[i] = hash(s.curbuf.Line(i)) s.oldhash[i] = hash(s.curbuf.Line(i))
s.newhash[i] = hash(s.newbuf.Line(i)) s.newhash[i] = hash(s.newbuf.Line(i))
} }
} }
s.hashtab = make([]hashmap, height*2) s.hashtab = make([]hashmap, height*2)
for i := 0; i < height; i++ { for i := range height {
hashval := s.oldhash[i] hashval := s.oldhash[i]
// Find matching hash or empty slot // Find matching hash or empty slot
@@ -71,7 +71,7 @@ func (s *Screen) updateHashmap() {
s.hashtab[idx].oldcount++ s.hashtab[idx].oldcount++
s.hashtab[idx].oldindex = i s.hashtab[idx].oldindex = i
} }
for i := 0; i < height; i++ { for i := range height {
hashval := s.newhash[i] hashval := s.newhash[i]
// Find matching hash or empty slot // Find matching hash or empty slot
@@ -130,7 +130,7 @@ func (s *Screen) updateHashmap() {
s.growHunks() s.growHunks()
} }
// scrollOldhash // scrollOldhash.
func (s *Screen) scrollOldhash(n, top, bot int) { func (s *Screen) scrollOldhash(n, top, bot int) {
if len(s.oldhash) == 0 { if len(s.oldhash) == 0 {
return return
@@ -287,7 +287,7 @@ func (s *Screen) updateCost(from, to Line) (cost int) {
cost++ cost++
} }
} }
return return cost
} }
func (s *Screen) updateCostBlank(to Line) (cost int) { func (s *Screen) updateCostBlank(to Line) (cost int) {
@@ -297,5 +297,5 @@ func (s *Screen) updateCostBlank(to Line) (cost int) {
cost++ cost++
} }
} }
return return cost
} }
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"github.com/charmbracelet/colorprofile" "github.com/charmbracelet/colorprofile"
) )
// Convert converts a hyperlink to respect the given color profile. // ConvertLink converts a hyperlink to respect the given color profile.
func ConvertLink(h Link, p colorprofile.Profile) Link { func ConvertLink(h Link, p colorprofile.Profile) Link {
if p == colorprofile.NoTTY { if p == colorprofile.NoTTY {
return Link{} return Link{}
+92
View File
@@ -0,0 +1,92 @@
package cellbuf
import (
"io"
"github.com/charmbracelet/x/ansi"
)
// PenWriter is a writer that writes to a buffer and keeps track of the current
// pen style and link state for the purpose of wrapping with newlines.
type PenWriter struct {
w io.Writer
p *ansi.Parser
style Style
link Link
}
// NewPenWriter returns a new PenWriter.
func NewPenWriter(w io.Writer) *PenWriter {
pw := &PenWriter{w: w}
pw.p = ansi.GetParser()
handleCsi := func(cmd ansi.Cmd, params ansi.Params) {
if cmd == 'm' {
ReadStyle(params, &pw.style)
}
}
handleOsc := func(cmd int, data []byte) {
if cmd == 8 {
ReadLink(data, &pw.link)
}
}
pw.p.SetHandler(ansi.Handler{
HandleCsi: handleCsi,
HandleOsc: handleOsc,
})
return pw
}
// Style returns the current pen style.
func (w *PenWriter) Style() Style {
return w.style
}
// Link returns the current pen link.
func (w *PenWriter) Link() Link {
return w.link
}
// Write writes to the buffer.
func (w *PenWriter) Write(p []byte) (int, error) {
for i := range p {
b := p[i]
w.p.Advance(b)
if b == '\n' {
if !w.style.Empty() {
_, _ = w.w.Write([]byte(ansi.ResetStyle))
}
if !w.link.Empty() {
_, _ = w.w.Write([]byte(ansi.ResetHyperlink()))
}
}
_, _ = w.w.Write([]byte{b})
if b == '\n' {
if !w.link.Empty() {
_, _ = w.w.Write([]byte(ansi.SetHyperlink(w.link.URL, w.link.Params)))
}
if !w.style.Empty() {
_, _ = w.w.Write([]byte(w.style.Sequence()))
}
}
}
return len(p), nil
}
// Close closes the writer, resets the style and link if necessary, and releases
// its parser. Calling it is performance critical, but forgetting it does not
// cause safety issues or leaks.
func (w *PenWriter) Close() error {
if !w.style.Empty() {
_, _ = w.w.Write([]byte(ansi.ResetStyle))
}
if !w.link.Empty() {
_, _ = w.w.Write([]byte(ansi.ResetHyperlink()))
}
if w.p != nil {
ansi.PutParser(w.p)
w.p = nil
}
return nil
}
+139 -82
View File
@@ -39,9 +39,9 @@ func relativeCursorMove(s *Screen, fx, fy, tx, ty int, overwrite, useTabs, useBa
var seq strings.Builder var seq strings.Builder
width, height := s.newbuf.Width(), s.newbuf.Height() width, height := s.newbuf.Width(), s.newbuf.Height()
if ty != fy { if ty != fy { //nolint:nestif
var yseq string var yseq string
if s.xtermLike && !s.opts.RelativeCursor { if s.caps.Contains(capVPA) && !s.opts.RelativeCursor {
yseq = ansi.VerticalPositionAbsolute(ty + 1) yseq = ansi.VerticalPositionAbsolute(ty + 1)
} }
@@ -54,9 +54,13 @@ func relativeCursorMove(s *Screen, fx, fy, tx, ty int, overwrite, useTabs, useBa
} }
shouldScroll := !s.opts.AltScreen && fy+n >= s.scrollHeight shouldScroll := !s.opts.AltScreen && fy+n >= s.scrollHeight
if lf := strings.Repeat("\n", n); shouldScroll || (fy+n < height && len(lf) < len(yseq)) { if lf := strings.Repeat("\n", n); shouldScroll || (fy+n < height && len(lf) < len(yseq)) {
//nolint:godox
// TODO: Ensure we're not unintentionally scrolling the screen down. // TODO: Ensure we're not unintentionally scrolling the screen down.
yseq = lf yseq = lf
s.scrollHeight = max(s.scrollHeight, fy+n) s.scrollHeight = max(s.scrollHeight, fy+n)
if s.opts.MapNL {
fx = 0
}
} }
} else if ty < fy { } else if ty < fy {
n := fy - ty n := fy - ty
@@ -64,6 +68,7 @@ func relativeCursorMove(s *Screen, fx, fy, tx, ty int, overwrite, useTabs, useBa
yseq = cuu yseq = cuu
} }
if n == 1 && fy-1 > 0 { if n == 1 && fy-1 > 0 {
//nolint:godox
// TODO: Ensure we're not unintentionally scrolling the screen up. // TODO: Ensure we're not unintentionally scrolling the screen up.
yseq = ansi.ReverseIndex yseq = ansi.ReverseIndex
} }
@@ -72,9 +77,9 @@ func relativeCursorMove(s *Screen, fx, fy, tx, ty int, overwrite, useTabs, useBa
seq.WriteString(yseq) seq.WriteString(yseq)
} }
if tx != fx { if tx != fx { //nolint:nestif
var xseq string var xseq string
if s.xtermLike && !s.opts.RelativeCursor { if s.caps.Contains(capHPA) && !s.opts.RelativeCursor {
xseq = ansi.HorizontalPositionAbsolute(tx + 1) xseq = ansi.HorizontalPositionAbsolute(tx + 1)
} }
@@ -93,7 +98,8 @@ func relativeCursorMove(s *Screen, fx, fy, tx, ty int, overwrite, useTabs, useBa
if tabs > 0 { if tabs > 0 {
cht := ansi.CursorHorizontalForwardTab(tabs) cht := ansi.CursorHorizontalForwardTab(tabs)
tab := strings.Repeat("\t", tabs) tab := strings.Repeat("\t", tabs)
if false && s.xtermLike && len(cht) < len(tab) { if false && s.caps.Contains(capCHT) && len(cht) < len(tab) {
//nolint:godox
// TODO: The linux console and some terminals such as // TODO: The linux console and some terminals such as
// Alacritty don't support [ansi.CHT]. Enable this when // Alacritty don't support [ansi.CHT]. Enable this when
// we have a way to detect this, or after 5 years when // we have a way to detect this, or after 5 years when
@@ -144,7 +150,7 @@ func relativeCursorMove(s *Screen, fx, fy, tx, ty int, overwrite, useTabs, useBa
} }
} else if tx < fx { } else if tx < fx {
n := fx - tx n := fx - tx
if useTabs && s.xtermLike { if useTabs && s.caps.Contains(capCBT) {
// VT100 does not support backward tabs [ansi.CBT]. // VT100 does not support backward tabs [ansi.CBT].
col := fx col := fx
@@ -190,7 +196,7 @@ func moveCursor(s *Screen, x, y int, overwrite bool) (seq string) {
// Method #0: Use [ansi.CUP] if the distance is long. // Method #0: Use [ansi.CUP] if the distance is long.
seq = ansi.CursorPosition(x+1, y+1) seq = ansi.CursorPosition(x+1, y+1)
if fx == -1 || fy == -1 || notLocal(s.newbuf.Width(), fx, fy, x, y) { if fx == -1 || fy == -1 || notLocal(s.newbuf.Width(), fx, fy, x, y) {
return return seq
} }
} }
@@ -234,7 +240,7 @@ func moveCursor(s *Screen, x, y int, overwrite bool) (seq string) {
} }
} }
return return seq
} }
// moveCursor moves the cursor to the specified position. // moveCursor moves the cursor to the specified position.
@@ -242,10 +248,10 @@ func (s *Screen) moveCursor(x, y int, overwrite bool) {
if !s.opts.AltScreen && s.cur.X == -1 && s.cur.Y == -1 { if !s.opts.AltScreen && s.cur.X == -1 && s.cur.Y == -1 {
// First cursor movement in inline mode, move the cursor to the first // First cursor movement in inline mode, move the cursor to the first
// column before moving to the target position. // column before moving to the target position.
s.buf.WriteByte('\r') //nolint:errcheck s.buf.WriteByte('\r')
s.cur.X, s.cur.Y = 0, 0 s.cur.X, s.cur.Y = 0, 0
} }
s.buf.WriteString(moveCursor(s, x, y, overwrite)) //nolint:errcheck s.buf.WriteString(moveCursor(s, x, y, overwrite))
s.cur.X, s.cur.Y = x, y s.cur.X, s.cur.Y = x, y
} }
@@ -274,10 +280,11 @@ func (s *Screen) move(x, y int) {
// Reset wrap around (phantom cursor) state // Reset wrap around (phantom cursor) state
if s.atPhantom { if s.atPhantom {
s.cur.X = 0 s.cur.X = 0
s.buf.WriteByte('\r') //nolint:errcheck s.buf.WriteByte('\r')
s.atPhantom = false // reset phantom cell state s.atPhantom = false // reset phantom cell state
} }
//nolint:godox
// TODO: Investigate if we need to handle this case and/or if we need the // TODO: Investigate if we need to handle this case and/or if we need the
// following code. // following code.
// //
@@ -291,7 +298,7 @@ func (s *Screen) move(x, y int) {
// //
// if l > 0 { // if l > 0 {
// s.cur.X = 0 // s.cur.X = 0
// s.buf.WriteString("\r" + strings.Repeat("\n", l)) //nolint:errcheck // s.buf.WriteString("\r" + strings.Repeat("\n", l))
// } // }
// } // }
@@ -339,6 +346,10 @@ type ScreenOptions struct {
HardTabs bool HardTabs bool
// Backspace is whether to use backspace characters to move the cursor. // Backspace is whether to use backspace characters to move the cursor.
Backspace bool Backspace bool
// MapNL whether we have ONLCR mapping enabled. When we set the terminal to
// raw mode, the ONLCR mode gets disabled. ONLCR maps any newline/linefeed
// (`\n`) character to carriage return + line feed (`\r\n`).
MapNL bool
} }
// lineData represents the metadata for a line. // lineData represents the metadata for a line.
@@ -365,13 +376,13 @@ type Screen struct {
opts ScreenOptions opts ScreenOptions
mu sync.Mutex mu sync.Mutex
method ansi.Method method ansi.Method
scrollHeight int // keeps track of how many lines we've scrolled down (inline mode) scrollHeight int // keeps track of how many lines we've scrolled down (inline mode)
altScreenMode bool // whether alternate screen mode is enabled altScreenMode bool // whether alternate screen mode is enabled
cursorHidden bool // whether text cursor mode is enabled cursorHidden bool // whether text cursor mode is enabled
clear bool // whether to force clear the screen clear bool // whether to force clear the screen
xtermLike bool // whether to use xterm-like optimizations, otherwise, it uses vt100 only caps capabilities // terminal control sequence capabilities
queuedText bool // whether we have queued non-zero width text queued up queuedText bool // whether we have queued non-zero width text queued up
atPhantom bool // whether the cursor is out of bounds and at a phantom cell atPhantom bool // whether the cursor is out of bounds and at a phantom cell
} }
// SetMethod sets the method used to calculate the width of cells. // SetMethod sets the method used to calculate the width of cells.
@@ -491,36 +502,77 @@ func (s *Screen) FillRect(cell *Cell, r Rectangle) bool {
return true return true
} }
// isXtermLike returns whether the terminal is xterm-like. This means that the // capabilities represents a mask of supported ANSI escape sequences.
type capabilities uint
const (
// Vertical Position Absolute [ansi.VPA].
capVPA capabilities = 1 << iota
// Horizontal Position Absolute [ansi.HPA].
capHPA
// Cursor Horizontal Tab [ansi.CHT].
capCHT
// Cursor Backward Tab [ansi.CBT].
capCBT
// Repeat Previous Character [ansi.REP].
capREP
// Erase Character [ansi.ECH].
capECH
// Insert Character [ansi.ICH].
capICH
// Scroll Down [ansi.SD].
capSD
// Scroll Up [ansi.SU].
capSU
noCaps capabilities = 0
allCaps = capVPA | capHPA | capCHT | capCBT | capREP | capECH | capICH |
capSD | capSU
)
// Contains returns whether the capabilities contains the given capability.
func (v capabilities) Contains(c capabilities) bool {
return v&c == c
}
// xtermCaps returns whether the terminal is xterm-like. This means that the
// terminal supports ECMA-48 and ANSI X3.64 escape sequences. // terminal supports ECMA-48 and ANSI X3.64 escape sequences.
// TODO: Should this be a lookup table into each $TERM terminfo database? Like // xtermCaps returns a list of control sequence capabilities for the given
// we could keep a map of ANSI escape sequence to terminfo capability name and // terminal type. This only supports a subset of sequences that can
// check if the database supports the escape sequence. Instead of keeping a // be different among terminals.
// list of terminal names here. // NOTE: A hybrid approach would be to support Terminfo databases for a full
func isXtermLike(termtype string) (v bool) { // set of capabilities.
func xtermCaps(termtype string) (v capabilities) {
parts := strings.Split(termtype, "-") parts := strings.Split(termtype, "-")
if len(parts) == 0 { if len(parts) == 0 {
return return v
} }
switch parts[0] { switch parts[0] {
case case
"alacritty",
"contour", "contour",
"foot", "foot",
"ghostty", "ghostty",
"kitty", "kitty",
"linux",
"rio", "rio",
"screen",
"st", "st",
"tmux", "tmux",
"wezterm", "wezterm",
"xterm": "xterm":
v = true v = allCaps
case "alacritty":
v = allCaps
v &^= capCHT // NOTE: alacritty added support for [ansi.CHT] in 2024-12-28 #62d5b13.
case "screen":
// See https://www.gnu.org/software/screen/manual/screen.html#Control-Sequences-1
v = allCaps
v &^= capREP
case "linux":
// See https://man7.org/linux/man-pages/man4/console_codes.4.html
v = capVPA | capHPA | capECH | capICH
} }
return return v
} }
// NewScreen creates a new Screen. // NewScreen creates a new Screen.
@@ -548,14 +600,14 @@ func NewScreen(w io.Writer, width, height int, opts *ScreenOptions) (s *Screen)
} }
s.buf = new(bytes.Buffer) s.buf = new(bytes.Buffer)
s.xtermLike = isXtermLike(s.opts.Term) s.caps = xtermCaps(s.opts.Term)
s.curbuf = NewBuffer(width, height) s.curbuf = NewBuffer(width, height)
s.newbuf = NewBuffer(width, height) s.newbuf = NewBuffer(width, height)
s.cur = Cursor{Position: Pos(-1, -1)} // start at -1 to force a move s.cur = Cursor{Position: Pos(-1, -1)} // start at -1 to force a move
s.saved = s.cur s.saved = s.cur
s.reset() s.reset()
return return s
} }
// Width returns the width of the screen. // Width returns the width of the screen.
@@ -595,7 +647,7 @@ func (s *Screen) putCell(cell *Cell) {
// wrapCursor wraps the cursor to the next line. // wrapCursor wraps the cursor to the next line.
// //
//nolint:unused
func (s *Screen) wrapCursor() { func (s *Screen) wrapCursor() {
const autoRightMargin = true const autoRightMargin = true
if autoRightMargin { if autoRightMargin {
@@ -628,9 +680,9 @@ func (s *Screen) putAttrCell(cell *Cell) {
} }
s.updatePen(cell) s.updatePen(cell)
s.buf.WriteRune(cell.Rune) //nolint:errcheck s.buf.WriteRune(cell.Rune)
for _, c := range cell.Comb { for _, c := range cell.Comb {
s.buf.WriteRune(c) //nolint:errcheck s.buf.WriteRune(c)
} }
s.cur.X += cell.Width s.cur.X += cell.Width
@@ -649,12 +701,12 @@ func (s *Screen) putCellLR(cell *Cell) {
// Optimize for the lower right corner cell. // Optimize for the lower right corner cell.
curX := s.cur.X curX := s.cur.X
if cell == nil || !cell.Empty() { if cell == nil || !cell.Empty() {
s.buf.WriteString(ansi.ResetAutoWrapMode) //nolint:errcheck s.buf.WriteString(ansi.ResetModeAutoWrap)
s.putAttrCell(cell) s.putAttrCell(cell)
// Writing to lower-right corner cell should not wrap. // Writing to lower-right corner cell should not wrap.
s.atPhantom = false s.atPhantom = false
s.cur.X = curX s.cur.X = curX
s.buf.WriteString(ansi.SetAutoWrapMode) //nolint:errcheck s.buf.WriteString(ansi.SetModeAutoWrap)
} }
} }
@@ -675,11 +727,11 @@ func (s *Screen) updatePen(cell *Cell) {
if cell.Style.Empty() && len(seq) > len(ansi.ResetStyle) { if cell.Style.Empty() && len(seq) > len(ansi.ResetStyle) {
seq = ansi.ResetStyle seq = ansi.ResetStyle
} }
s.buf.WriteString(seq) //nolint:errcheck s.buf.WriteString(seq)
s.cur.Style = cell.Style s.cur.Style = cell.Style
} }
if !cell.Link.Equal(&s.cur.Link) { if !cell.Link.Equal(&s.cur.Link) {
s.buf.WriteString(ansi.SetHyperlink(cell.Link.URL, cell.Link.Params)) //nolint:errcheck s.buf.WriteString(ansi.SetHyperlink(cell.Link.URL, cell.Link.Params))
s.cur.Link = cell.Link s.cur.Link = cell.Link
} }
} }
@@ -712,9 +764,9 @@ func (s *Screen) emitRange(line Line, n int) (eoi bool) {
ech := ansi.EraseCharacter(count) ech := ansi.EraseCharacter(count)
cup := ansi.CursorPosition(s.cur.X+count, s.cur.Y) cup := ansi.CursorPosition(s.cur.X+count, s.cur.Y)
rep := ansi.RepeatPreviousCharacter(count) rep := ansi.RepeatPreviousCharacter(count)
if s.xtermLike && count > len(ech)+len(cup) && cell0 != nil && cell0.Clear() { if s.caps.Contains(capECH) && count > len(ech)+len(cup) && cell0 != nil && cell0.Clear() { //nolint:nestif
s.updatePen(cell0) s.updatePen(cell0)
s.buf.WriteString(ech) //nolint:errcheck s.buf.WriteString(ech)
// If this is the last cell, we don't need to move the cursor. // If this is the last cell, we don't need to move the cursor.
if count < n { if count < n {
@@ -722,7 +774,7 @@ func (s *Screen) emitRange(line Line, n int) (eoi bool) {
} else { } else {
return true // cursor in the middle return true // cursor in the middle
} }
} else if s.xtermLike && count > len(rep) && } else if s.caps.Contains(capREP) && count > len(rep) &&
(cell0 == nil || (len(cell0.Comb) == 0 && cell0.Rune < 256)) { (cell0 == nil || (len(cell0.Comb) == 0 && cell0.Rune < 256)) {
// We only support ASCII characters. Most terminals will handle // We only support ASCII characters. Most terminals will handle
// non-ASCII characters correctly, but some might not, ahem xterm. // non-ASCII characters correctly, but some might not, ahem xterm.
@@ -740,13 +792,13 @@ func (s *Screen) emitRange(line Line, n int) (eoi bool) {
s.putCell(cell0) s.putCell(cell0)
repCount-- // cell0 is a single width cell ASCII character repCount-- // cell0 is a single width cell ASCII character
s.buf.WriteString(ansi.RepeatPreviousCharacter(repCount)) //nolint:errcheck s.buf.WriteString(ansi.RepeatPreviousCharacter(repCount))
s.cur.X += repCount s.cur.X += repCount
if wrapPossible { if wrapPossible {
s.putCell(cell0) s.putCell(cell0)
} }
} else { } else {
for i := 0; i < count; i++ { for i := range count {
s.putCell(line.At(i)) s.putCell(line.At(i))
} }
} }
@@ -755,7 +807,7 @@ func (s *Screen) emitRange(line Line, n int) (eoi bool) {
n -= count n -= count
} }
return return eoi
} }
// putRange puts a range of cells from the old line to the new line. // putRange puts a range of cells from the old line to the new line.
@@ -765,7 +817,7 @@ func (s *Screen) putRange(oldLine, newLine Line, y, start, end int) (eoi bool) {
inline := min(len(ansi.CursorPosition(start+1, y+1)), inline := min(len(ansi.CursorPosition(start+1, y+1)),
min(len(ansi.HorizontalPositionAbsolute(start+1)), min(len(ansi.HorizontalPositionAbsolute(start+1)),
len(ansi.CursorForward(start+1)))) len(ansi.CursorForward(start+1))))
if (end - start + 1) > inline { if (end - start + 1) > inline { //nolint:nestif
var j, same int var j, same int
for j, same = start, 0; j <= end; j++ { for j, same = start, 0; j <= end; j++ {
oldCell, newCell := oldLine.At(j), newLine.At(j) oldCell, newCell := oldLine.At(j), newLine.At(j)
@@ -817,9 +869,9 @@ func (s *Screen) clearToEnd(blank *Cell, force bool) { //nolint:unparam
s.updatePen(blank) s.updatePen(blank)
count := s.newbuf.Width() - s.cur.X count := s.newbuf.Width() - s.cur.X
if s.el0Cost() <= count { if s.el0Cost() <= count {
s.buf.WriteString(ansi.EraseLineRight) //nolint:errcheck s.buf.WriteString(ansi.EraseLineRight)
} else { } else {
for i := 0; i < count; i++ { for range count {
s.putCell(blank) s.putCell(blank)
} }
} }
@@ -839,12 +891,13 @@ func (s *Screen) clearBlank() *Cell {
// insertCells inserts the count cells pointed by the given line at the current // insertCells inserts the count cells pointed by the given line at the current
// cursor position. // cursor position.
func (s *Screen) insertCells(line Line, count int) { func (s *Screen) insertCells(line Line, count int) {
if s.xtermLike { supportsICH := s.caps.Contains(capICH)
if supportsICH {
// Use [ansi.ICH] as an optimization. // Use [ansi.ICH] as an optimization.
s.buf.WriteString(ansi.InsertCharacter(count)) //nolint:errcheck s.buf.WriteString(ansi.InsertCharacter(count))
} else { } else {
// Otherwise, use [ansi.IRM] mode. // Otherwise, use [ansi.IRM] mode.
s.buf.WriteString(ansi.SetInsertReplaceMode) //nolint:errcheck s.buf.WriteString(ansi.SetModeInsertReplace)
} }
for i := 0; count > 0; i++ { for i := 0; count > 0; i++ {
@@ -852,8 +905,8 @@ func (s *Screen) insertCells(line Line, count int) {
count-- count--
} }
if !s.xtermLike { if !supportsICH {
s.buf.WriteString(ansi.ResetInsertReplaceMode) //nolint:errcheck s.buf.WriteString(ansi.ResetModeInsertReplace)
} }
} }
@@ -862,7 +915,7 @@ func (s *Screen) insertCells(line Line, count int) {
// [ansi.EL] 0 i.e. [ansi.EraseLineRight] to clear // [ansi.EL] 0 i.e. [ansi.EraseLineRight] to clear
// trailing spaces. // trailing spaces.
func (s *Screen) el0Cost() int { func (s *Screen) el0Cost() int {
if s.xtermLike { if s.caps != noCaps {
return 0 return 0
} }
return len(ansi.EraseLineRight) return len(ansi.EraseLineRight)
@@ -878,7 +931,7 @@ func (s *Screen) transformLine(y int) {
// Find the first changed cell in the line // Find the first changed cell in the line
var lineChanged bool var lineChanged bool
for i := 0; i < s.newbuf.Width(); i++ { for i := range s.newbuf.Width() {
if !cellEqual(newLine.At(i), oldLine.At(i)) { if !cellEqual(newLine.At(i), oldLine.At(i)) {
lineChanged = true lineChanged = true
break break
@@ -886,7 +939,7 @@ func (s *Screen) transformLine(y int) {
} }
const ceolStandoutGlitch = false const ceolStandoutGlitch = false
if ceolStandoutGlitch && lineChanged { if ceolStandoutGlitch && lineChanged { //nolint:nestif
s.move(0, y) s.move(0, y)
s.clearToEnd(nil, false) s.clearToEnd(nil, false)
s.putRange(oldLine, newLine, y, 0, s.newbuf.Width()-1) s.putRange(oldLine, newLine, y, 0, s.newbuf.Width()-1)
@@ -897,12 +950,12 @@ func (s *Screen) transformLine(y int) {
// [ansi.EraseLineLeft]. // [ansi.EraseLineLeft].
if blank == nil || blank.Clear() { if blank == nil || blank.Clear() {
var oFirstCell, nFirstCell int var oFirstCell, nFirstCell int
for oFirstCell = 0; oFirstCell < s.curbuf.Width(); oFirstCell++ { for oFirstCell = range s.curbuf.Width() {
if !cellEqual(oldLine.At(oFirstCell), blank) { if !cellEqual(oldLine.At(oFirstCell), blank) {
break break
} }
} }
for nFirstCell = 0; nFirstCell < s.newbuf.Width(); nFirstCell++ { for nFirstCell = range s.newbuf.Width() {
if !cellEqual(newLine.At(nFirstCell), blank) { if !cellEqual(newLine.At(nFirstCell), blank) {
break break
} }
@@ -925,11 +978,11 @@ func (s *Screen) transformLine(y int) {
if nFirstCell >= s.newbuf.Width() { if nFirstCell >= s.newbuf.Width() {
s.move(0, y) s.move(0, y)
s.updatePen(blank) s.updatePen(blank)
s.buf.WriteString(ansi.EraseLineRight) //nolint:errcheck s.buf.WriteString(ansi.EraseLineRight)
} else { } else {
s.move(nFirstCell-1, y) s.move(nFirstCell-1, y)
s.updatePen(blank) s.updatePen(blank)
s.buf.WriteString(ansi.EraseLineLeft) //nolint:errcheck s.buf.WriteString(ansi.EraseLineLeft)
} }
for firstCell < nFirstCell { for firstCell < nFirstCell {
@@ -1045,7 +1098,7 @@ func (s *Screen) transformLine(y int) {
s.move(n+1, y) s.move(n+1, y)
ichCost := 3 + nLastCell - oLastCell ichCost := 3 + nLastCell - oLastCell
if s.xtermLike && (nLastCell < nLastNonBlank || ichCost > (m-n)) { if s.caps.Contains(capICH) && (nLastCell < nLastNonBlank || ichCost > (m-n)) {
s.putRange(oldLine, newLine, y, n+1, m) s.putRange(oldLine, newLine, y, n+1, m)
} else { } else {
s.insertCells(newLine[n+1:], nLastCell-oLastCell) s.insertCells(newLine[n+1:], nLastCell-oLastCell)
@@ -1079,7 +1132,7 @@ func (s *Screen) transformLine(y int) {
func (s *Screen) deleteCells(count int) { func (s *Screen) deleteCells(count int) {
// [ansi.DCH] will shift in cells from the right margin so we need to // [ansi.DCH] will shift in cells from the right margin so we need to
// ensure that they are the right style. // ensure that they are the right style.
s.buf.WriteString(ansi.DeleteCharacter(count)) //nolint:errcheck s.buf.WriteString(ansi.DeleteCharacter(count))
} }
// clearToBottom clears the screen from the current cursor position to the end // clearToBottom clears the screen from the current cursor position to the end
@@ -1091,7 +1144,7 @@ func (s *Screen) clearToBottom(blank *Cell) {
} }
s.updatePen(blank) s.updatePen(blank)
s.buf.WriteString(ansi.EraseScreenBelow) //nolint:errcheck s.buf.WriteString(ansi.EraseScreenBelow)
// Clear the rest of the current line // Clear the rest of the current line
s.curbuf.ClearRect(Rect(col, row, s.curbuf.Width()-col, 1)) s.curbuf.ClearRect(Rect(col, row, s.curbuf.Width()-col, 1))
// Clear everything below the current line // Clear everything below the current line
@@ -1104,7 +1157,7 @@ func (s *Screen) clearToBottom(blank *Cell) {
// It returns the top line. // It returns the top line.
func (s *Screen) clearBottom(total int) (top int) { func (s *Screen) clearBottom(total int) (top int) {
if total <= 0 { if total <= 0 {
return return top
} }
top = total top = total
@@ -1112,7 +1165,7 @@ func (s *Screen) clearBottom(total int) (top int) {
blank := s.clearBlank() blank := s.clearBlank()
canClearWithBlank := blank == nil || blank.Clear() canClearWithBlank := blank == nil || blank.Clear()
if canClearWithBlank { if canClearWithBlank { //nolint:nestif
var row int var row int
for row = total - 1; row >= 0; row-- { for row = total - 1; row >= 0; row-- {
oldLine := s.curbuf.Line(row) oldLine := s.curbuf.Line(row)
@@ -1147,14 +1200,14 @@ func (s *Screen) clearBottom(total int) (top int) {
} }
} }
return return top
} }
// clearScreen clears the screen and put cursor at home. // clearScreen clears the screen and put cursor at home.
func (s *Screen) clearScreen(blank *Cell) { func (s *Screen) clearScreen(blank *Cell) {
s.updatePen(blank) s.updatePen(blank)
s.buf.WriteString(ansi.CursorHomePosition) //nolint:errcheck s.buf.WriteString(ansi.CursorHomePosition)
s.buf.WriteString(ansi.EraseEntireScreen) //nolint:errcheck s.buf.WriteString(ansi.EraseEntireScreen)
s.cur.X, s.cur.Y = 0, 0 s.cur.X, s.cur.Y = 0, 0
s.curbuf.Fill(blank) s.curbuf.Fill(blank)
} }
@@ -1179,7 +1232,7 @@ func (s *Screen) clearUpdate() {
s.clearBelow(blank, 0) s.clearBelow(blank, 0)
} }
nonEmpty = s.clearBottom(nonEmpty) nonEmpty = s.clearBottom(nonEmpty)
for i := 0; i < nonEmpty; i++ { for i := range nonEmpty {
s.transformLine(i) s.transformLine(i)
} }
} }
@@ -1194,13 +1247,13 @@ func (s *Screen) Flush() (err error) {
func (s *Screen) flush() (err error) { func (s *Screen) flush() (err error) {
// Write the buffer // Write the buffer
if s.buf.Len() > 0 { if s.buf.Len() > 0 {
_, err = s.w.Write(s.buf.Bytes()) //nolint:errcheck _, err = s.w.Write(s.buf.Bytes())
if err == nil { if err == nil {
s.buf.Reset() s.buf.Reset()
} }
} }
return return err //nolint:wrapcheck
} }
// Render renders changes of the screen to the internal buffer. Call // Render renders changes of the screen to the internal buffer. Call
@@ -1221,6 +1274,7 @@ func (s *Screen) render() {
return return
} }
//nolint:godox
// TODO: Investigate whether this is necessary. Theoretically, terminals // TODO: Investigate whether this is necessary. Theoretically, terminals
// can add/remove tab stops and we should be able to handle that. We could // can add/remove tab stops and we should be able to handle that. We could
// use [ansi.DECTABSR] to read the tab stops, but that's not implemented in // use [ansi.DECTABSR] to read the tab stops, but that's not implemented in
@@ -1235,9 +1289,9 @@ func (s *Screen) render() {
// Do we need alt-screen mode? // Do we need alt-screen mode?
if s.opts.AltScreen != s.altScreenMode { if s.opts.AltScreen != s.altScreenMode {
if s.opts.AltScreen { if s.opts.AltScreen {
s.buf.WriteString(ansi.SetAltScreenSaveCursorMode) s.buf.WriteString(ansi.SetModeAltScreenSaveCursor)
} else { } else {
s.buf.WriteString(ansi.ResetAltScreenSaveCursorMode) s.buf.WriteString(ansi.ResetModeAltScreenSaveCursor)
} }
s.altScreenMode = s.opts.AltScreen s.altScreenMode = s.opts.AltScreen
} }
@@ -1252,7 +1306,9 @@ func (s *Screen) render() {
// Do we have queued strings to write above the screen? // Do we have queued strings to write above the screen?
if len(s.queueAbove) > 0 { if len(s.queueAbove) > 0 {
//nolint:godox
// TODO: Use scrolling region if available. // TODO: Use scrolling region if available.
//nolint:godox
// TODO: Use [Screen.Write] [io.Writer] interface. // TODO: Use [Screen.Write] [io.Writer] interface.
// We need to scroll the screen up by the number of lines in the queue. // We need to scroll the screen up by the number of lines in the queue.
@@ -1290,12 +1346,13 @@ func (s *Screen) render() {
s.clearBelow(nil, s.newbuf.Height()-1) s.clearBelow(nil, s.newbuf.Height()-1)
} }
if s.clear { if s.clear { //nolint:nestif
s.clearUpdate() s.clearUpdate()
s.clear = false s.clear = false
} else if len(s.touch) > 0 { } else if len(s.touch) > 0 {
if s.opts.AltScreen { if s.opts.AltScreen {
// Optimize scrolling for the alternate screen buffer. // Optimize scrolling for the alternate screen buffer.
//nolint:godox
// TODO: Should we optimize for inline mode as well? If so, we need // TODO: Should we optimize for inline mode as well? If so, we need
// to know the actual cursor position to use [ansi.DECSTBM]. // to know the actual cursor position to use [ansi.DECSTBM].
s.scrollOptimize() s.scrollOptimize()
@@ -1311,7 +1368,7 @@ func (s *Screen) render() {
} }
nonEmpty = s.clearBottom(nonEmpty) nonEmpty = s.clearBottom(nonEmpty)
for i = 0; i < nonEmpty; i++ { for i = range nonEmpty {
_, ok := s.touch[i] _, ok := s.touch[i]
if ok { if ok {
s.transformLine(i) s.transformLine(i)
@@ -1359,7 +1416,7 @@ func (s *Screen) Close() (err error) {
s.move(0, s.newbuf.Height()-1) s.move(0, s.newbuf.Height()-1)
if s.altScreenMode { if s.altScreenMode {
s.buf.WriteString(ansi.ResetAltScreenSaveCursorMode) s.buf.WriteString(ansi.ResetModeAltScreenSaveCursor)
s.altScreenMode = false s.altScreenMode = false
} }
@@ -1371,11 +1428,11 @@ func (s *Screen) Close() (err error) {
// Write the buffer // Write the buffer
err = s.flush() err = s.flush()
if err != nil { if err != nil {
return return err
} }
s.reset() s.reset()
return return err
} }
// reset resets the screen to its initial state. // reset resets the screen to its initial state.
@@ -1420,9 +1477,9 @@ func (s *Screen) Resize(width, height int) bool {
} }
if height > oldh { if height > oldh {
s.ClearRect(Rect(0, max(oldh-1, 0), width, height-oldh)) s.ClearRect(Rect(0, max(oldh, 0), width, height-oldh))
} else if height < oldh { } else if height < oldh {
s.ClearRect(Rect(0, max(height-1, 0), width, oldh-height)) s.ClearRect(Rect(0, max(height, 0), width, oldh-height))
} }
s.mu.Lock() s.mu.Lock()
+2 -2
View File
@@ -4,9 +4,9 @@ import (
"github.com/charmbracelet/colorprofile" "github.com/charmbracelet/colorprofile"
) )
// Convert converts a style to respect the given color profile. // ConvertStyle converts a style to respect the given color profile.
func ConvertStyle(s Style, p colorprofile.Profile) Style { func ConvertStyle(s Style, p colorprofile.Profile) Style {
switch p { switch p { //nolint:exhaustive
case colorprofile.TrueColor: case colorprofile.TrueColor:
return s return s
case colorprofile.Ascii: case colorprofile.Ascii:
-14
View File
@@ -9,20 +9,6 @@ func Height(s string) int {
return strings.Count(s, "\n") + 1 return strings.Count(s, "\n") + 1
} }
func min(a, b int) int { //nolint:predeclared
if a > b {
return b
}
return a
}
func max(a, b int) int { //nolint:predeclared
if a > b {
return a
}
return b
}
func clamp(v, low, high int) int { func clamp(v, low, high int) int {
if high < low { if high < low {
low, high = high, low low, high = high, low
+13 -7
View File
@@ -2,6 +2,7 @@ package cellbuf
import ( import (
"bytes" "bytes"
"slices"
"unicode" "unicode"
"unicode/utf8" "unicode/utf8"
@@ -20,6 +21,16 @@ const nbsp = '\u00a0'
// //
// Note: breakpoints must be a string of 1-cell wide rune characters. // Note: breakpoints must be a string of 1-cell wide rune characters.
func Wrap(s string, limit int, breakpoints string) string { func Wrap(s string, limit int, breakpoints string) string {
//nolint:godox
// TODO: Use [PenWriter] once we get
// https://github.com/charmbracelet/lipgloss/pull/489 out the door and
// released.
// The problem is that [ansi.Wrap] doesn't keep track of style and link
// state, so combining both breaks styled space cells. To fix this, we use
// non-breaking space cells for padding and styled blank cells. And since
// both wrapping methods respect non-breaking spaces, we can use them to
// preserve styled spaces in the output.
if len(s) == 0 { if len(s) == 0 {
return "" return ""
} }
@@ -90,7 +101,7 @@ func Wrap(s string, limit int, breakpoints string) string {
seq, width, n, newState := ansi.DecodeSequence(s, state, p) seq, width, n, newState := ansi.DecodeSequence(s, state, p)
switch width { switch width {
case 0: case 0:
if ansi.Equal(seq, "\t") { if ansi.Equal(seq, "\t") { //nolint:nestif
addWord() addWord()
space.WriteString(seq) space.WriteString(seq)
break break
@@ -176,10 +187,5 @@ func Wrap(s string, limit int, breakpoints string) string {
} }
func runeContainsAny[T string | []rune](r rune, s T) bool { func runeContainsAny[T string | []rune](r rune, s T) bool {
for _, c := range []rune(s) { return slices.Contains([]rune(s), r)
if c == r {
return true
}
}
return false
} }
+15 -14
View File
@@ -25,7 +25,7 @@ type CellBuffer interface {
func FillRect(s CellBuffer, c *Cell, rect Rectangle) { func FillRect(s CellBuffer, c *Cell, rect Rectangle) {
for y := rect.Min.Y; y < rect.Max.Y; y++ { for y := rect.Min.Y; y < rect.Max.Y; y++ {
for x := rect.Min.X; x < rect.Max.X; x++ { for x := rect.Min.X; x < rect.Max.X; x++ {
s.SetCell(x, y, c) //nolint:errcheck s.SetCell(x, y, c)
} }
} }
} }
@@ -68,7 +68,7 @@ func SetContent(s CellBuffer, str string) {
func Render(d CellBuffer) string { func Render(d CellBuffer) string {
var buf bytes.Buffer var buf bytes.Buffer
height := d.Bounds().Dy() height := d.Bounds().Dy()
for y := 0; y < height; y++ { for y := range height {
_, line := RenderLine(d, y) _, line := RenderLine(d, y)
buf.WriteString(line) buf.WriteString(line)
if y < height-1 { if y < height-1 {
@@ -98,32 +98,32 @@ func RenderLine(d CellBuffer, n int) (w int, line string) {
pendingLine = "" pendingLine = ""
} }
for x := 0; x < d.Bounds().Dx(); x++ { for x := range d.Bounds().Dx() {
if cell := d.Cell(x, n); cell != nil && cell.Width > 0 { if cell := d.Cell(x, n); cell != nil && cell.Width > 0 { //nolint:nestif
// Convert the cell's style and link to the given color profile. // Convert the cell's style and link to the given color profile.
cellStyle := cell.Style cellStyle := cell.Style
cellLink := cell.Link cellLink := cell.Link
if cellStyle.Empty() && !pen.Empty() { if cellStyle.Empty() && !pen.Empty() {
writePending() writePending()
buf.WriteString(ansi.ResetStyle) //nolint:errcheck buf.WriteString(ansi.ResetStyle)
pen.Reset() pen.Reset()
} }
if !cellStyle.Equal(&pen) { if !cellStyle.Equal(&pen) {
writePending() writePending()
seq := cellStyle.DiffSequence(pen) seq := cellStyle.DiffSequence(pen)
buf.WriteString(seq) // nolint:errcheck buf.WriteString(seq)
pen = cellStyle pen = cellStyle
} }
// Write the URL escape sequence // Write the URL escape sequence
if cellLink != link && link.URL != "" { if cellLink != link && link.URL != "" {
writePending() writePending()
buf.WriteString(ansi.ResetHyperlink()) //nolint:errcheck buf.WriteString(ansi.ResetHyperlink())
link.Reset() link.Reset()
} }
if cellLink != link { if cellLink != link {
writePending() writePending()
buf.WriteString(ansi.SetHyperlink(cellLink.URL, cellLink.Params)) //nolint:errcheck buf.WriteString(ansi.SetHyperlink(cellLink.URL, cellLink.Params))
link = cellLink link = cellLink
} }
@@ -140,10 +140,10 @@ func RenderLine(d CellBuffer, n int) (w int, line string) {
} }
} }
if link.URL != "" { if link.URL != "" {
buf.WriteString(ansi.ResetHyperlink()) //nolint:errcheck buf.WriteString(ansi.ResetHyperlink())
} }
if !pen.Empty() { if !pen.Empty() {
buf.WriteString(ansi.ResetStyle) //nolint:errcheck buf.WriteString(ansi.ResetStyle)
} }
return w, strings.TrimRight(buf.String(), " ") // Trim trailing spaces return w, strings.TrimRight(buf.String(), " ") // Trim trailing spaces
} }
@@ -201,7 +201,7 @@ func (s *ScreenWriter) SetContentRect(str string, rect Rectangle) {
// string to the width of the screen if it exceeds the width of the screen. // string to the width of the screen if it exceeds the width of the screen.
// This will recognize ANSI [ansi.SGR] style and [ansi.SetHyperlink] escape // This will recognize ANSI [ansi.SGR] style and [ansi.SetHyperlink] escape
// sequences. // sequences.
func (s *ScreenWriter) Print(str string, v ...interface{}) { func (s *ScreenWriter) Print(str string, v ...any) {
if len(v) > 0 { if len(v) > 0 {
str = fmt.Sprintf(str, v...) str = fmt.Sprintf(str, v...)
} }
@@ -214,7 +214,7 @@ func (s *ScreenWriter) Print(str string, v ...interface{}) {
// the width of the screen if it exceeds the width of the screen. // the width of the screen if it exceeds the width of the screen.
// This will recognize ANSI [ansi.SGR] style and [ansi.SetHyperlink] escape // This will recognize ANSI [ansi.SGR] style and [ansi.SetHyperlink] escape
// sequences. // sequences.
func (s *ScreenWriter) PrintAt(x, y int, str string, v ...interface{}) { func (s *ScreenWriter) PrintAt(x, y int, str string, v ...any) {
if len(v) > 0 { if len(v) > 0 {
str = fmt.Sprintf(str, v...) str = fmt.Sprintf(str, v...)
} }
@@ -299,7 +299,7 @@ func printString[T []byte | string](
// Print the cell to the screen // Print the cell to the screen
cell.Style = style cell.Style = style
cell.Link = link cell.Link = link
s.SetCell(x, y, &cell) //nolint:errcheck s.SetCell(x, y, &cell)
x += width x += width
} }
} }
@@ -309,6 +309,7 @@ func printString[T []byte | string](
cell.Reset() cell.Reset()
default: default:
// Valid sequences always have a non-zero Cmd. // Valid sequences always have a non-zero Cmd.
//nolint:godox
// TODO: Handle cursor movement and other sequences // TODO: Handle cursor movement and other sequences
switch { switch {
case ansi.HasCsiPrefix(seq) && p.Command() == 'm': case ansi.HasCsiPrefix(seq) && p.Command() == 'm':
@@ -333,7 +334,7 @@ func printString[T []byte | string](
// Make sure to set the last cell if it's not empty. // Make sure to set the last cell if it's not empty.
if !cell.Empty() { if !cell.Empty() {
s.SetCell(x, y, &cell) //nolint:errcheck s.SetCell(x, y, &cell)
cell.Reset() cell.Reset()
} }
} }
+2
View File
@@ -1,3 +1,5 @@
// Package term provides a platform-independent interfaces for interacting with
// Terminal and TTY devices.
package term package term
// State contains platform-specific state of a terminal. // State contains platform-specific state of a terminal.
+118
View File
@@ -0,0 +1,118 @@
package term
import (
"fmt"
"os"
"path/filepath"
"strings"
)
type state struct {
termName string
raw bool
ctl *os.File
}
// termName returns the name of the terminal or os.ErrNotExist if there is no terminal.
func termName(fd uintptr) (string, error) {
ctl, err := os.ReadFile(filepath.Join("/fd", fmt.Sprintf("%dctl", fd)))
if err != nil {
return "", err
}
f := strings.Fields(string(ctl))
if len(f) == 0 {
return "", os.ErrNotExist
}
return f[len(f)-1], nil
}
func isTerminal(fd uintptr) bool {
ctl, err := os.ReadFile(filepath.Join("/fd", fmt.Sprintf("%dctl", fd)))
if err != nil {
return false
}
if strings.Contains(string(ctl), "/dev/cons") {
return true
}
return false
}
func makeRaw(fd uintptr) (*State, error) {
t, err := termName(fd)
if err != nil {
return nil, err
}
ctl, err := os.OpenFile(t, os.O_RDWR, 0)
if err != nil {
return nil, err
}
if _, err := ctl.Write([]byte("rawon")); err != nil {
return nil, err
}
return &State{state: state{termName: t, raw: true, ctl: ctl}}, nil
}
func getState(fd uintptr) (*State, error) {
t, err := termName(fd)
if err != nil {
return nil, err
}
ctl, err := os.OpenFile(t, os.O_RDWR, 0)
if err != nil {
return nil, err
}
return &State{state: state{termName: t, raw: false, ctl: ctl}}, nil
}
func restore(_ uintptr, state *State) error {
if _, err := state.ctl.Write([]byte("rawoff")); err != nil {
return err
}
return nil
}
// getSize returns the size. This will only work if you are running
// under a window manager in Plan 9. Else, the only option
// is to return a reasonable default.
func getSize(fd uintptr) (int, int, error) {
w, h := 80, 40
b, err := os.ReadFile("/dev/wctl")
if err != nil {
return w, h, err
}
f := strings.Fields(string(b))
if len(f) != 4 {
return w, h, fmt.Errorf("%q only has %d of 4 needed fields:%w", f, len(f), os.ErrInvalid)
}
// The contents of wctl, as defined in the driver, are
// 4 12-char fields: upper left x, y; and lower-right x, y
var ulx, uly, lrx, lry int
if n, err := fmt.Sscanf(string(b[:48]), "%d%d%d%d", &ulx, &uly, &lrx, &lry); n != 4 || err != nil {
return w, h, fmt.Errorf("scanning %q:%d of 4 items scanned:%w", string(b[:48]), n, err)
}
w, h = lrx-lrx, lry-uly
return w, h, nil
}
func setState(_ uintptr, state *State) error {
raw := "rawoff"
if state.raw {
raw = "rawon"
}
if _, err := state.ctl.Write([]byte(raw)); err != nil {
return err
}
return nil
}
func readPassword(fd uintptr) ([]byte, error) {
f := os.NewFile(fd, "cons")
var b [128]byte
n, err := f.Read(b[:])
if err != nil {
return nil, err
}
return b[:n], nil
}
+10 -10
View File
@@ -19,7 +19,7 @@ func isTerminal(fd uintptr) bool {
func makeRaw(fd uintptr) (*State, error) { func makeRaw(fd uintptr) (*State, error) {
termios, err := unix.IoctlGetTermios(int(fd), ioctlReadTermios) termios, err := unix.IoctlGetTermios(int(fd), ioctlReadTermios)
if err != nil { if err != nil {
return nil, err return nil, err //nolint:wrapcheck
} }
oldState := State{state{Termios: *termios}} oldState := State{state{Termios: *termios}}
@@ -34,7 +34,7 @@ func makeRaw(fd uintptr) (*State, error) {
termios.Cc[unix.VMIN] = 1 termios.Cc[unix.VMIN] = 1
termios.Cc[unix.VTIME] = 0 termios.Cc[unix.VTIME] = 0
if err := unix.IoctlSetTermios(int(fd), ioctlWriteTermios, termios); err != nil { if err := unix.IoctlSetTermios(int(fd), ioctlWriteTermios, termios); err != nil {
return nil, err return nil, err //nolint:wrapcheck
} }
return &oldState, nil return &oldState, nil
@@ -45,26 +45,26 @@ func setState(fd uintptr, state *State) error {
if state != nil { if state != nil {
termios = &state.Termios termios = &state.Termios
} }
return unix.IoctlSetTermios(int(fd), ioctlWriteTermios, termios) return unix.IoctlSetTermios(int(fd), ioctlWriteTermios, termios) //nolint:wrapcheck
} }
func getState(fd uintptr) (*State, error) { func getState(fd uintptr) (*State, error) {
termios, err := unix.IoctlGetTermios(int(fd), ioctlReadTermios) termios, err := unix.IoctlGetTermios(int(fd), ioctlReadTermios)
if err != nil { if err != nil {
return nil, err return nil, err //nolint:wrapcheck
} }
return &State{state{Termios: *termios}}, nil return &State{state{Termios: *termios}}, nil
} }
func restore(fd uintptr, state *State) error { func restore(fd uintptr, state *State) error {
return unix.IoctlSetTermios(int(fd), ioctlWriteTermios, &state.Termios) return unix.IoctlSetTermios(int(fd), ioctlWriteTermios, &state.Termios) //nolint:wrapcheck
} }
func getSize(fd uintptr) (width, height int, err error) { func getSize(fd uintptr) (width, height int, err error) {
ws, err := unix.IoctlGetWinsize(int(fd), unix.TIOCGWINSZ) ws, err := unix.IoctlGetWinsize(int(fd), unix.TIOCGWINSZ)
if err != nil { if err != nil {
return 0, 0, err return 0, 0, err //nolint:wrapcheck
} }
return int(ws.Col), int(ws.Row), nil return int(ws.Col), int(ws.Row), nil
} }
@@ -73,13 +73,13 @@ func getSize(fd uintptr) (width, height int, err error) {
type passwordReader int type passwordReader int
func (r passwordReader) Read(buf []byte) (int, error) { func (r passwordReader) Read(buf []byte) (int, error) {
return unix.Read(int(r), buf) return unix.Read(int(r), buf) //nolint:wrapcheck
} }
func readPassword(fd uintptr) ([]byte, error) { func readPassword(fd uintptr) ([]byte, error) {
termios, err := unix.IoctlGetTermios(int(fd), ioctlReadTermios) termios, err := unix.IoctlGetTermios(int(fd), ioctlReadTermios)
if err != nil { if err != nil {
return nil, err return nil, err //nolint:wrapcheck
} }
newState := *termios newState := *termios
@@ -87,10 +87,10 @@ func readPassword(fd uintptr) ([]byte, error) {
newState.Lflag |= unix.ICANON | unix.ISIG newState.Lflag |= unix.ICANON | unix.ISIG
newState.Iflag |= unix.ICRNL newState.Iflag |= unix.ICRNL
if err := unix.IoctlSetTermios(int(fd), ioctlWriteTermios, &newState); err != nil { if err := unix.IoctlSetTermios(int(fd), ioctlWriteTermios, &newState); err != nil {
return nil, err return nil, err //nolint:wrapcheck
} }
defer unix.IoctlSetTermios(int(fd), ioctlWriteTermios, termios) defer unix.IoctlSetTermios(int(fd), ioctlWriteTermios, termios) //nolint:errcheck
return readPasswordLine(passwordReader(fd)) return readPasswordLine(passwordReader(fd))
} }
+1 -1
View File
@@ -24,7 +24,7 @@ func makeRaw(fd uintptr) (*State, error) {
if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil { if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
return nil, err return nil, err
} }
raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT) raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT)
raw |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT raw |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT
if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil { if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
return nil, err return nil, err
+1 -1
View File
@@ -41,7 +41,7 @@ func readPasswordLine(reader io.Reader) ([]byte, error) {
if err == io.EOF && len(ret) > 0 { if err == io.EOF && len(ret) > 0 {
return ret, nil return ret, nil
} }
return ret, err return ret, err //nolint:wrapcheck
} }
} }
} }
+3
View File
@@ -0,0 +1,3 @@
.DS_Store
*.out
*.test
+51
View File
@@ -0,0 +1,51 @@
The goals and overview of this package can be found in the README.md file,
start by reading that.
The goal of this package is to determine the display (column) width of a
string, UTF-8 bytes, or runes, as would happen in a monospace font, especially
in a terminal.
When troubleshooting, write Go unit tests instead of executing debug scripts.
The tests can return whatever logs or output you need. If those tests are
only for temporary troubleshooting, clean up the tests after the debugging is
done.
(Separate executable debugging scripts are messy, tend to have conflicting
dependencies and are hard to cleanup.)
If you make changes to the trie generation in internal/gen, it can be invoked
by running `go generate` from the top package directory.
## Pull Requests and branches
For PRs (pull requests), you can use the gh CLI tool. Compare the current branch with main. Reviewing a PR and reviewing a branch are about the same, but the PR may add context.
Understand the goals of the PR. Note any API changes, especially breaking changes.
Look for thoroughness of tests, as well as GoDoc comments.
Retrieve and consider the comments on the PR, which may have come from GitHub Copilot or Cursor BugBot. Think like GitHub Copilot or Cursor BugBot.
Offer to optionally post a brief summary of the review to the PR, via the gh CLI tool.
## Tagged Go releases
If I ask you whether we are ready to release, this means a tagged Go release on the main branch. Go releases are git tagged with a version number.
Review the changes since the last release, i.e. the previous git tag. Ensure that the changes are complete and correct. Identify new features, bug fixes, and performance improvements.
Identify breaking changes, especially API changes.
Ensure good test coverage. Look for performance changes, especially performance regressions, by running benchmarks against the previous release.
Ensure that the documentation in READMEs and GoDocs are complete, correct and consistent.
## Comparisons to go-runewidth
We originally attempted to make this package compatible with go-runewidth.
However, we found that there were too many differences in the handling of
certain characters and properties.
We believe, preliminarily, that our choices are more correct and complete,
by using more complete categories such as Unicode Cf (format) for zero-width
and Mn (Nonspacing_Mark) for combining marks.
+129
View File
@@ -0,0 +1,129 @@
# Changelog
## [0.11.0]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.10.0...v0.11.0)
### Added
- New `ControlSequences8Bit` option to treat 8-bit ECMA-48 (C1) escape sequences as zero-width. (#22)
### Changed
- Upgraded uax29 dependency to v2.7.0 for 8-bit escape sequence support in the grapheme iterator.
- Truncation now validates that preserved trailing escape sequences are zero-width, preventing edge cases where non-zero-width sequences could leak into output.
### Note
- `ControlSequences8Bit` is deliberately ignored by `TruncateString` and `TruncateBytes`, because C1 byte values (0x800x9F) overlap with UTF-8 multi-byte encoding.
## [0.10.0]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.9.0...v0.10.0)
### Added
- New `ControlSequences` option to treat ECMA-48/ANSI escape sequences as zero-width. (#20)
- `TruncateString` and `TruncateBytes` now preserve trailing ANSI escape sequences (such as SGR resets) when `ControlSequences` is true, preventing color bleed in terminal output.
### Changed
- Removed `stringish` dependency; generic type constraints are now inline `~string | []byte`.
- Upgraded uax29 dependency to v2.6.0 for ANSI escape sequence support in the grapheme iterator.
## [0.9.0]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.8.0...v0.9.0)
### Changed
- Unicode 17 support: East Asian Width and emoji data updated to Unicode 17.0.0. (#18)
- Upgraded uax29 dependency to v2.5.0 (Unicode 17 grapheme segmentation).
## [0.8.0]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.7.0...v0.8.0)
### Changed
- Performance: ASCII fast path that applies to any run of printable
ASCII. 2x-10x faster for ASCII text vs v0.7.0. (#16)
- Upgraded uax29 dependency to v2.4.0 for Unicode 16 support. Text that includes
Indic_Conjunct_Break may segment differently (and more correctly). (#15)
## [0.7.0]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.6.2...v0.7.0)
### Added
- New `TruncateString` and `TruncateBytes` methods to truncate strings to a
maximum display width, with optional tail (like an ellipsis). (#13)
## [0.6.2]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.6.1...v0.6.2)
### Changed
- Internal: reduced property categories for simpler trie.
## [0.6.1]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.6.0...v0.6.1)
### Changed
- Perf improvements: replaced the ASCII lookup table with a simple
function. A bit more cache-friendly. More inlining.
- Bug fix: single regional indicators are now treated as width 2, since that
is what actual terminals do.
## [0.6.0]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.5.0...v0.6.0)
### Added
- New `StringGraphemes` and `BytesGraphemes` methods, for iterating over the
widths of grapheme clusters.
### Changed
- Fast ASCII lookups
## [0.5.0]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.4.1...v0.5.0)
### Added
- Unicode 16 support
- Improved emoji presentation handling per Unicode TR51
### Changed
- Corrected VS15 (U+FE0E) handling: now preserves base character width (no-op) per Unicode TR51
- Performance optimizations: reduced property lookups
### Fixed
- VS15 variation selector now correctly preserves base character width instead of forcing width 1
## [0.4.1]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.4.0...v0.4.1)
### Changed
- Updated uax29 dependency
- Improved flag handling
## [0.4.0]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.3.1...v0.4.0)
### Added
- Support for variation selectors (VS15, VS16) and regional indicator pairs (flags)
## [0.3.1]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.3.0...v0.3.1)
### Added
- Fuzz testing support
### Changed
- Updated stringish dependency
## [0.3.0]
[Compare](https://github.com/clipperhouse/displaywidth/compare/v0.2.0...v0.3.0)
### Changed
- Dropped compatibility with go-runewidth
- Trie implementation cleanup
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Matt Sherman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+190
View File
@@ -0,0 +1,190 @@
# displaywidth
A high-performance Go package for measuring the monospace display width of strings, UTF-8 bytes, and runes.
[![Documentation](https://pkg.go.dev/badge/github.com/clipperhouse/displaywidth.svg)](https://pkg.go.dev/github.com/clipperhouse/displaywidth)
[![Test](https://github.com/clipperhouse/displaywidth/actions/workflows/gotest.yml/badge.svg)](https://github.com/clipperhouse/displaywidth/actions/workflows/gotest.yml)
[![Fuzz](https://github.com/clipperhouse/displaywidth/actions/workflows/gofuzz.yml/badge.svg)](https://github.com/clipperhouse/displaywidth/actions/workflows/gofuzz.yml)
## Install
```bash
go get github.com/clipperhouse/displaywidth
```
## Usage
```go
package main
import (
"fmt"
"github.com/clipperhouse/displaywidth"
)
func main() {
width := displaywidth.String("Hello, 世界!")
fmt.Println(width)
width = displaywidth.Bytes([]byte("🌍"))
fmt.Println(width)
width = displaywidth.Rune('🌍')
fmt.Println(width)
}
```
For most purposes, you should use the `String` or `Bytes` methods. They sum
the widths of grapheme clusters in the string or byte slice.
> Note: in your application, iterating over runes to measure width is likely incorrect;
the smallest unit of display is a grapheme, not a rune.
### Iterating over graphemes
If you need the individual graphemes:
```go
import (
"fmt"
"github.com/clipperhouse/displaywidth"
)
func main() {
g := displaywidth.StringGraphemes("Hello, 世界!")
for g.Next() {
width := g.Width()
value := g.Value()
// do something with the width or value
}
}
```
### Options
Create the options you need, and then use methods on the options struct.
```go
var myOptions = displaywidth.Options{
EastAsianWidth: true,
ControlSequences: true,
}
width := myOptions.String("Hello, 世界!")
```
#### ControlSequences
`ControlSequences` specifies whether to ignore ECMA-48 escape sequences
when calculating the display width. When `false` (default), ANSI escape
sequences are treated as just a series of characters. When `true`, they are
treated as a single zero-width unit.
#### ControlSequences8Bit
`ControlSequences8Bit` specifies whether to ignore 8-bit ECMA-48 escape sequences
when calculating the display width. When `false` (default), these are treated
as just a series of characters. When `true`, they are treated as a single
zero-width unit.
Note: this option is ignored by the `Truncate` methods, as the concatenation
can lead to unintended UTF-8 semantics.
#### EastAsianWidth
`EastAsianWidth` defines how
[East Asian Ambiguous characters](https://www.unicode.org/reports/tr11/#Ambiguous)
are treated.
When `false` (default), East Asian Ambiguous characters are treated as width 1.
When `true`, they are treated as width 2.
You may wish to configure this based on environment variables or locale.
`go-runewidth`, for example, does so
[during package initialization](https://github.com/mattn/go-runewidth/blob/master/runewidth.go#L26C1-L45C2). `displaywidth` does not do this automatically, we prefer to leave it to you.
## Technical standards and compatibility
This package implements the Unicode East Asian Width standard
([UAX #11](https://www.unicode.org/reports/tr11/tr11-43.html)), and handles
[version selectors](https://en.wikipedia.org/wiki/Variation_Selectors_(Unicode_block)),
and [regional indicator pairs](https://en.wikipedia.org/wiki/Regional_indicator_symbol)
(flags). We implement [Unicode TR51](https://www.unicode.org/reports/tr51/tr51-27.html)
for emojis. We are keeping an eye on
[emerging standards](https://www.jeffquast.com/post/state-of-terminal-emulation-2025/).
For control sequences, we implement the [ECMA-48](https://ecma-international.org/publications-and-standards/standards/ecma-48/) standard for 7-bit and 8-bit control sequences.
`clipperhouse/displaywidth`, `mattn/go-runewidth`, and `rivo/uniseg` will
give the same outputs for most real-world text. Extensive details are in the
[compatibility analysis](comparison/COMPATIBILITY_ANALYSIS.md).
## Invalid UTF-8
This package does not validate UTF-8. If you pass invalid UTF-8, the results
are undefined. We fuzz against invalid UTF-8 to ensure we don't panic or
loop indefinitely.
The `ControlSequences8Bit` option means that we will segment valid 8-bit
control sequences, which are typically _not_ valid UTF-8. 8-bit control bytes
happen to also be UTF-8 continuation bytes. Use with caution.
## Prior Art
[mattn/go-runewidth](https://github.com/mattn/go-runewidth)
[rivo/uniseg](https://github.com/rivo/uniseg)
[x/text/width](https://pkg.go.dev/golang.org/x/text/width)
[x/text/internal/triegen](https://pkg.go.dev/golang.org/x/text/internal/triegen)
## Benchmarks
```bash
cd comparison
go test -bench=. -benchmem
```
```
goos: darwin
goarch: arm64
pkg: github.com/clipperhouse/displaywidth/comparison
cpu: Apple M2
BenchmarkString_Mixed/clipperhouse/displaywidth-8 5784 ns/op 291.69 MB/s 0 B/op 0 allocs/op
BenchmarkString_Mixed/mattn/go-runewidth-8 14751 ns/op 114.36 MB/s 0 B/op 0 allocs/op
BenchmarkString_Mixed/rivo/uniseg-8 19360 ns/op 87.14 MB/s 0 B/op 0 allocs/op
BenchmarkString_ASCII/clipperhouse/displaywidth-8 54.60 ns/op 2344.32 MB/s 0 B/op 0 allocs/op
BenchmarkString_ASCII/mattn/go-runewidth-8 1195 ns/op 107.08 MB/s 0 B/op 0 allocs/op
BenchmarkString_ASCII/rivo/uniseg-8 1578 ns/op 81.13 MB/s 0 B/op 0 allocs/op
BenchmarkString_EastAsian/clipperhouse/displaywidth-8 5837 ns/op 289.01 MB/s 0 B/op 0 allocs/op
BenchmarkString_EastAsian/mattn/go-runewidth-8 24418 ns/op 69.09 MB/s 0 B/op 0 allocs/op
BenchmarkString_EastAsian/rivo/uniseg-8 19339 ns/op 87.23 MB/s 0 B/op 0 allocs/op
BenchmarkString_Emoji/clipperhouse/displaywidth-8 3225 ns/op 224.51 MB/s 0 B/op 0 allocs/op
BenchmarkString_Emoji/mattn/go-runewidth-8 4851 ns/op 149.25 MB/s 0 B/op 0 allocs/op
BenchmarkString_Emoji/rivo/uniseg-8 6591 ns/op 109.85 MB/s 0 B/op 0 allocs/op
BenchmarkRune_Mixed/clipperhouse/displaywidth-8 3385 ns/op 498.34 MB/s 0 B/op 0 allocs/op
BenchmarkRune_Mixed/mattn/go-runewidth-8 5354 ns/op 315.07 MB/s 0 B/op 0 allocs/op
BenchmarkRune_EastAsian/clipperhouse/displaywidth-8 3397 ns/op 496.56 MB/s 0 B/op 0 allocs/op
BenchmarkRune_EastAsian/mattn/go-runewidth-8 15673 ns/op 107.64 MB/s 0 B/op 0 allocs/op
BenchmarkRune_ASCII/clipperhouse/displaywidth-8 255.7 ns/op 500.53 MB/s 0 B/op 0 allocs/op
BenchmarkRune_ASCII/mattn/go-runewidth-8 261.5 ns/op 489.55 MB/s 0 B/op 0 allocs/op
BenchmarkRune_Emoji/clipperhouse/displaywidth-8 1371 ns/op 528.22 MB/s 0 B/op 0 allocs/op
BenchmarkRune_Emoji/mattn/go-runewidth-8 2267 ns/op 319.43 MB/s 0 B/op 0 allocs/op
BenchmarkTruncateWithTail/clipperhouse/displaywidth-8 3229 ns/op 54.82 MB/s 192 B/op 14 allocs/op
BenchmarkTruncateWithTail/mattn/go-runewidth-8 8408 ns/op 21.05 MB/s 192 B/op 14 allocs/op
BenchmarkTruncateWithoutTail/clipperhouse/displaywidth-8 3554 ns/op 64.43 MB/s 0 B/op 0 allocs/op
BenchmarkTruncateWithoutTail/mattn/go-runewidth-8 11189 ns/op 20.47 MB/s 0 B/op 0 allocs/op
```
Here are some notes on [how to make Unicode things fast](https://clipperhouse.com/go-unicode/).
+3
View File
@@ -0,0 +1,3 @@
package displaywidth
//go:generate go run -C internal/gen .
+73
View File
@@ -0,0 +1,73 @@
package displaywidth
import (
"github.com/clipperhouse/uax29/v2/graphemes"
)
// Graphemes is an iterator over grapheme clusters.
//
// Iterate using the Next method, and get the width of the current grapheme
// using the Width method.
type Graphemes[T ~string | []byte] struct {
iter *graphemes.Iterator[T]
options Options
}
// Next advances the iterator to the next grapheme cluster.
func (g *Graphemes[T]) Next() bool {
return g.iter.Next()
}
// Value returns the current grapheme cluster.
func (g *Graphemes[T]) Value() T {
return g.iter.Value()
}
// Width returns the display width of the current grapheme cluster.
func (g *Graphemes[T]) Width() int {
return graphemeWidth(g.Value(), g.options)
}
// StringGraphemes returns an iterator over grapheme clusters for the given
// string.
//
// Iterate using the Next method, and get the width of the current grapheme
// using the Width method.
func StringGraphemes(s string) Graphemes[string] {
return DefaultOptions.StringGraphemes(s)
}
// StringGraphemes returns an iterator over grapheme clusters for the given
// string, with the given options.
//
// Iterate using the Next method, and get the width of the current grapheme
// using the Width method.
func (options Options) StringGraphemes(s string) Graphemes[string] {
g := graphemes.FromString(s)
g.AnsiEscapeSequences = options.ControlSequences
g.AnsiEscapeSequences8Bit = options.ControlSequences8Bit
return Graphemes[string]{iter: g, options: options}
}
// BytesGraphemes returns an iterator over grapheme clusters for the given
// []byte.
//
// Iterate using the Next method, and get the width of the current grapheme
// using the Width method.
func BytesGraphemes(s []byte) Graphemes[[]byte] {
return DefaultOptions.BytesGraphemes(s)
}
// BytesGraphemes returns an iterator over grapheme clusters for the given
// []byte, with the given options.
//
// Iterate using the Next method, and get the width of the current grapheme
// using the Width method.
func (options Options) BytesGraphemes(s []byte) Graphemes[[]byte] {
g := graphemes.FromBytes(s)
g.AnsiEscapeSequences = options.ControlSequences
g.AnsiEscapeSequences8Bit = options.ControlSequences8Bit
return Graphemes[[]byte]{iter: g, options: options}
}
+30
View File
@@ -0,0 +1,30 @@
package displaywidth
// Options allows you to specify the treatment of ambiguous East Asian
// characters and ANSI escape sequences.
type Options struct {
// EastAsianWidth specifies whether to treat ambiguous East Asian characters
// as width 1 or 2. When false (default), ambiguous East Asian characters
// are treated as width 1. When true, they are width 2.
EastAsianWidth bool
// ControlSequences specifies whether to ignore 7-bit ECMA-48 escape sequences
// when calculating the display width. When false (default), ANSI escape
// sequences are treated as just a series of characters. When true, they are
// treated as a single zero-width unit.
ControlSequences bool
// ControlSequences8Bit specifies whether to ignore 8-bit ECMA-48 escape sequences
// when calculating the display width. When false (default), these are treated
// as just a series of characters. When true, they are treated as a single
// zero-width unit.
ControlSequences8Bit bool
}
// DefaultOptions is the default options for the display width
// calculation, which is EastAsianWidth false, ControlSequences false, and
// ControlSequences8Bit false.
var DefaultOptions = Options{
EastAsianWidth: false,
ControlSequences: false,
ControlSequences8Bit: false,
}
File diff suppressed because it is too large Load Diff
+149
View File
@@ -0,0 +1,149 @@
package displaywidth
import (
"strings"
"github.com/clipperhouse/uax29/v2/graphemes"
)
// TruncateString truncates a string to the given maxWidth, and appends the
// given tail if the string is truncated.
//
// It ensures the visible width, including the width of the tail, is less than or
// equal to maxWidth.
//
// When [Options.ControlSequences] is true, 7-bit ANSI escape sequences that
// appear after the truncation point are preserved in the output. This ensures
// that escape sequences such as SGR resets are not lost, preventing color
// bleed in terminal output.
//
// [Options.ControlSequences8Bit] is ignored by truncation. 8-bit C1 byte values
// (0x80-0x9F) overlap with UTF-8 multi-byte encoding, so manipulating them
// during truncation can shift byte boundaries and form unintended visible
// characters. Use [Options.String] or [Options.Bytes] for 8-bit-aware width
// measurement.
func (options Options) TruncateString(s string, maxWidth int, tail string) string {
// We deliberately ignore ControlSequences8Bit for truncation, see above.
options.ControlSequences8Bit = false
maxWidthWithoutTail := maxWidth - options.String(tail)
var pos, total int
g := graphemes.FromString(s)
g.AnsiEscapeSequences = options.ControlSequences
for g.Next() {
gw := graphemeWidth(g.Value(), options)
if total+gw <= maxWidthWithoutTail {
pos = g.End()
}
total += gw
if total > maxWidth {
if options.ControlSequences {
// Build result with trailing 7-bit ANSI escape sequences preserved
var b strings.Builder
b.Grow(len(s) + len(tail)) // at most original + tail
b.WriteString(s[:pos])
b.WriteString(tail)
rem := graphemes.FromString(s[pos:])
rem.AnsiEscapeSequences = options.ControlSequences
for rem.Next() {
v := rem.Value()
// Only preserve 7-bit escapes (ESC = 0x1B) that measure
// as zero-width on their own; some sequences (e.g. SOS)
// are only valid in their original context.
if len(v) > 0 && v[0] == 0x1B && options.String(v) == 0 {
b.WriteString(v)
}
}
return b.String()
}
return s[:pos] + tail
}
}
// No truncation
return s
}
// TruncateString truncates a string to the given maxWidth, and appends the
// given tail if the string is truncated.
//
// It ensures the total width, including the width of the tail, is less than or
// equal to maxWidth.
func TruncateString(s string, maxWidth int, tail string) string {
return DefaultOptions.TruncateString(s, maxWidth, tail)
}
// TruncateBytes truncates a []byte to the given maxWidth, and appends the
// given tail if the []byte is truncated.
//
// It ensures the visible width, including the width of the tail, is less than or
// equal to maxWidth.
//
// When [Options.ControlSequences] is true, 7-bit ANSI escape sequences that
// appear after the truncation point are preserved in the output. This ensures
// that escape sequences such as SGR resets are not lost, preventing color
// bleed in terminal output.
//
// [Options.ControlSequences8Bit] is ignored by truncation. 8-bit C1 byte values
// (0x80-0x9F) overlap with UTF-8 multi-byte encoding, so manipulating them
// during truncation can shift byte boundaries and form unintended visible
// characters. Use [Options.String] or [Options.Bytes] for 8-bit-aware width
// measurement.
func (options Options) TruncateBytes(s []byte, maxWidth int, tail []byte) []byte {
// We deliberately ignore ControlSequences8Bit for truncation, see above.
options.ControlSequences8Bit = false
maxWidthWithoutTail := maxWidth - options.Bytes(tail)
var pos, total int
g := graphemes.FromBytes(s)
g.AnsiEscapeSequences = options.ControlSequences
for g.Next() {
gw := graphemeWidth(g.Value(), options)
if total+gw <= maxWidthWithoutTail {
pos = g.End()
}
total += gw
if total > maxWidth {
if options.ControlSequences {
// Build result with trailing 7-bit ANSI escape sequences preserved
result := make([]byte, 0, len(s)+len(tail)) // at most original + tail
result = append(result, s[:pos]...)
result = append(result, tail...)
rem := graphemes.FromBytes(s[pos:])
rem.AnsiEscapeSequences = options.ControlSequences
for rem.Next() {
v := rem.Value()
// Only preserve 7-bit escapes (ESC = 0x1B) that measure
// as zero-width on their own; some sequences (e.g. SOS)
// are only valid in their original context.
if len(v) > 0 && v[0] == 0x1B && options.Bytes(v) == 0 {
result = append(result, v...)
}
}
return result
}
result := make([]byte, 0, pos+len(tail))
result = append(result, s[:pos]...)
result = append(result, tail...)
return result
}
}
// No truncation
return s
}
// TruncateBytes truncates a []byte to the given maxWidth, and appends the
// given tail if the []byte is truncated.
//
// It ensures the total width, including the width of the tail, is less than or
// equal to maxWidth.
func TruncateBytes(s []byte, maxWidth int, tail []byte) []byte {
return DefaultOptions.TruncateBytes(s, maxWidth, tail)
}
+239
View File
@@ -0,0 +1,239 @@
package displaywidth
import (
"unicode/utf8"
"github.com/clipperhouse/uax29/v2/graphemes"
)
// String calculates the display width of a string,
// by iterating over grapheme clusters in the string
// and summing their widths.
func String(s string) int {
return DefaultOptions.String(s)
}
// String calculates the display width of a string, for the given options, by
// iterating over grapheme clusters in the string and summing their widths.
func (options Options) String(s string) int {
width := 0
pos := 0
for pos < len(s) {
// Try ASCII optimization
asciiLen := printableASCIILength(s[pos:])
if asciiLen > 0 {
width += asciiLen
pos += asciiLen
continue
}
// Not ASCII, use grapheme parsing
g := graphemes.FromString(s[pos:])
g.AnsiEscapeSequences = options.ControlSequences
g.AnsiEscapeSequences8Bit = options.ControlSequences8Bit
start := pos
for g.Next() {
v := g.Value()
width += graphemeWidth(v, options)
pos += len(v)
// Quick check: if remaining might have printable ASCII, break to outer loop
if pos < len(s) && s[pos] >= 0x20 && s[pos] <= 0x7E {
break
}
}
// Defensive, should not happen: if no progress was made,
// skip a byte to prevent infinite loop. Only applies if
// the grapheme parser misbehaves.
if pos == start {
pos++
}
}
return width
}
// Bytes calculates the display width of a []byte,
// by iterating over grapheme clusters in the byte slice
// and summing their widths.
func Bytes(s []byte) int {
return DefaultOptions.Bytes(s)
}
// Bytes calculates the display width of a []byte, for the given options, by
// iterating over grapheme clusters in the slice and summing their widths.
func (options Options) Bytes(s []byte) int {
width := 0
pos := 0
for pos < len(s) {
// Try ASCII optimization
asciiLen := printableASCIILength(s[pos:])
if asciiLen > 0 {
width += asciiLen
pos += asciiLen
continue
}
// Not ASCII, use grapheme parsing
g := graphemes.FromBytes(s[pos:])
g.AnsiEscapeSequences = options.ControlSequences
g.AnsiEscapeSequences8Bit = options.ControlSequences8Bit
start := pos
for g.Next() {
v := g.Value()
width += graphemeWidth(v, options)
pos += len(v)
// Quick check: if remaining might have printable ASCII, break to outer loop
if pos < len(s) && s[pos] >= 0x20 && s[pos] <= 0x7E {
break
}
}
// Defensive, should not happen: if no progress was made,
// skip a byte to prevent infinite loop. Only applies if
// the grapheme parser misbehaves.
if pos == start {
pos++
}
}
return width
}
// Rune calculates the display width of a rune. You
// should almost certainly use [String] or [Bytes] for
// most purposes.
//
// The smallest unit of display width is a grapheme
// cluster, not a rune. Iterating over runes to measure
// width is incorrect in many cases.
func Rune(r rune) int {
return DefaultOptions.Rune(r)
}
// Rune calculates the display width of a rune, for the given options.
//
// You should almost certainly use [String] or [Bytes] for most purposes.
//
// The smallest unit of display width is a grapheme cluster, not a rune.
// Iterating over runes to measure width is incorrect in many cases.
func (options Options) Rune(r rune) int {
if r < utf8.RuneSelf {
return asciiWidth(byte(r))
}
// Surrogates (U+D800-U+DFFF) are invalid UTF-8.
if r >= 0xD800 && r <= 0xDFFF {
return 0
}
var buf [4]byte
n := utf8.EncodeRune(buf[:], r)
// Skip the grapheme iterator
return graphemeWidth(buf[:n], options)
}
const _Default property = 0
// graphemeWidth returns the display width of a grapheme cluster.
// The passed string must be a single grapheme cluster.
func graphemeWidth[T ~string | []byte](s T, options Options) int {
if len(s) == 0 {
return 0
}
// C1 controls (0x80-0x9F) are zero-width when 8-bit control sequences
// are enabled. This must be checked before the single-byte optimization
// below, which would otherwise return width 1 for these bytes.
if options.ControlSequences8Bit && s[0] >= 0x80 && s[0] <= 0x9F {
return 0
}
// Optimization: single-byte graphemes need no property lookup
if len(s) == 1 {
return asciiWidth(s[0])
}
// Multi-byte grapheme clusters led by a C0 control (0x00-0x1F)
if s[0] <= 0x1F {
return 0
}
p, sz := lookup(s)
prop := property(p)
// Variation Selector 16 (VS16) requests emoji presentation
if prop != _Wide && sz > 0 && len(s) >= sz+3 {
vs := s[sz : sz+3]
if isVS16(vs) {
prop = _Wide
}
// VS15 (0x8E) requests text presentation but does not affect width,
// in my reading of Unicode TR51. Falls through to return the base
// character's property.
}
if options.EastAsianWidth && prop == _East_Asian_Ambiguous {
prop = _Wide
}
if prop > upperBound {
prop = _Default
}
return propertyWidths[prop]
}
func asciiWidth(b byte) int {
if b <= 0x1F || b == 0x7F {
return 0
}
return 1
}
// printableASCIILength returns the length of consecutive printable ASCII bytes
// starting at the beginning of s.
func printableASCIILength[T string | []byte](s T) int {
i := 0
for ; i < len(s); i++ {
b := s[i]
// Printable ASCII is 0x20-0x7E (space through tilde)
if b < 0x20 || b > 0x7E {
break
}
}
// If the next byte is non-ASCII (>= 0x80), back off by 1. The grapheme
// parser may group the last ASCII byte with subsequent non-ASCII bytes,
// such as combining marks.
if i > 0 && i < len(s) && s[i] >= 0x80 {
i--
}
return i
}
// isVS16 checks if the slice matches VS16 (U+FE0F) UTF-8 encoding
// (EF B8 8F). It assumes len(s) >= 3.
func isVS16[T ~string | []byte](s T) bool {
return s[0] == 0xEF && s[1] == 0xB8 && s[2] == 0x8F
}
// propertyWidths is a jump table of sorts, instead of a switch
var propertyWidths = [4]int{
_Default: 1,
_Zero_Width: 0,
_Wide: 2,
_East_Asian_Ambiguous: 1,
}
const upperBound = property(len(propertyWidths) - 1)
+63 -25
View File
@@ -1,32 +1,34 @@
An implementation of grapheme cluster boundaries from [Unicode text segmentation](https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries) (UAX 29), for Unicode version 15.0.0. An implementation of grapheme cluster boundaries from [Unicode text segmentation](https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries) (UAX 29), for Unicode 17.
[![Documentation](https://pkg.go.dev/badge/github.com/clipperhouse/uax29/v2/graphemes.svg)](https://pkg.go.dev/github.com/clipperhouse/uax29/v2/graphemes)
![Tests](https://github.com/clipperhouse/uax29/actions/workflows/gotest.yml/badge.svg)
![Fuzz](https://github.com/clipperhouse/uax29/actions/workflows/gofuzz.yml/badge.svg)
## Quick start ## Quick start
``` ```
go get "github.com/clipperhouse/uax29/v2/graphemes" go get github.com/clipperhouse/uax29/v2/graphemes
``` ```
```go ```go
import "github.com/clipperhouse/uax29/v2/graphemes" import "github.com/clipperhouse/uax29/v2/graphemes"
text := "Hello, 世界. Nice dog! 👍🐶" text := "Hello, 世界. Nice dog! 👍🐶"
g := graphemes.FromString(text)
tokens := graphemes.FromString(text) for g.Next() { // Next() returns true until end of data
fmt.Println(g.Value()) // Do something with the current grapheme
for tokens.Next() { // Next() returns true until end of data
fmt.Println(tokens.Value()) // Do something with the current grapheme
} }
``` ```
[![Documentation](https://pkg.go.dev/badge/github.com/clipperhouse/uax29/v2/graphemes.svg)](https://pkg.go.dev/github.com/clipperhouse/uax29/v2/graphemes)
_A grapheme is a “single visible character”, which might be a simple as a single letter, or a complex emoji that consists of several Unicode code points._ _A grapheme is a “single visible character”, which might be a simple as a single letter, or a complex emoji that consists of several Unicode code points._
## Conformance ## Conformance
We use the Unicode [test suite](https://unicode.org/reports/tr41/tr41-26.html#Tests29). Status: We use the Unicode [test suite](https://unicode.org/reports/tr41/tr41-36.html#Tests29).
![Go](https://github.com/clipperhouse/uax29/actions/workflows/gotest.yml/badge.svg) ![Tests](https://github.com/clipperhouse/uax29/actions/workflows/gotest.yml/badge.svg)
![Fuzz](https://github.com/clipperhouse/uax29/actions/workflows/gofuzz.yml/badge.svg)
## APIs ## APIs
@@ -34,11 +36,10 @@ We use the Unicode [test suite](https://unicode.org/reports/tr41/tr41-26.html#Te
```go ```go
text := "Hello, 世界. Nice dog! 👍🐶" text := "Hello, 世界. Nice dog! 👍🐶"
g := graphemes.FromString(text)
tokens := graphemes.FromString(text) for g.Next() { // Next() returns true until end of data
fmt.Println(g.Value()) // Do something with the current grapheme
for tokens.Next() { // Next() returns true until end of data
fmt.Println(tokens.Value()) // Do something with the current grapheme
} }
``` ```
@@ -47,15 +48,15 @@ for tokens.Next() { // Next() returns true until end of data
`FromReader` embeds a [`bufio.Scanner`](https://pkg.go.dev/bufio#Scanner), so just use those methods. `FromReader` embeds a [`bufio.Scanner`](https://pkg.go.dev/bufio#Scanner), so just use those methods.
```go ```go
r := getYourReader() // from a file or network maybe r := getYourReader() // from a file or network maybe
tokens := graphemes.FromReader(r) g := graphemes.FromReader(r)
for tokens.Scan() { // Scan() returns true until error or EOF for g.Scan() { // Scan() returns true until error or EOF
fmt.Println(tokens.Text()) // Do something with the current grapheme fmt.Println(g.Text()) // Do something with the current grapheme
} }
if tokens.Err() != nil { // Check the error if g.Err() != nil { // Check the error
log.Fatal(tokens.Err()) log.Fatal(g.Err())
} }
``` ```
@@ -64,16 +65,53 @@ if tokens.Err() != nil { // Check the error
```go ```go
b := []byte("Hello, 世界. Nice dog! 👍🐶") b := []byte("Hello, 世界. Nice dog! 👍🐶")
tokens := graphemes.FromBytes(b) g := graphemes.FromBytes(b)
for tokens.Next() { // Next() returns true until end of data for g.Next() { // Next() returns true until end of data
fmt.Println(tokens.Value()) // Do something with the current grapheme fmt.Println(g.Value()) // Do something with the current grapheme
} }
``` ```
### Performance ### ANSI escape sequences
On a Mac M2 laptop, we see around 200MB/s, or around 100 million graphemes per second. You should see ~constant memory, and no allocations. By the UAX 29 specification, ANSI escape sequences are not grapheme clusters. To treat 7-bit ANSI escape sequences as a single cluster, set `AnsiEscapeSequences` to true.
```go
text := "Hello, \x1b[31mworld\x1b[0m!"
g := graphemes.FromString(text)
g.AnsiEscapeSequences = true
for g.Next() {
fmt.Println(g.Value())
}
```
To also parse 8-bit C1 controls (non-UTF-8 bytes), set `AnsiEscapeSequences8Bit` to true.
```go
g.AnsiEscapeSequences = true // 7-bit forms (ESC ...)
g.AnsiEscapeSequences8Bit = true // 8-bit C1 forms (0x80-0x9F), not valid UTF-8
```
For ESC-initiated (7-bit) control strings, only 7-bit terminators are recognized.
For C1-initiated (8-bit) control strings, only C1 ST (`0x9C`) is recognized as ST.
We implement [ECMA-48](https://ecma-international.org/publications-and-standards/standards/ecma-48/) control codes in both 7-bit and 8-bit representations. 8-bit control codes are not UTF-8 encoded and are not valid UTF-8, caveat emptor.
### Benchmarks
```
goos: darwin
goarch: arm64
pkg: github.com/clipperhouse/uax29/graphemes/comparative
cpu: Apple M2
BenchmarkGraphemesMixed/clipperhouse/uax29-8 142635 ns/op 245.12 MB/s 0 B/op 0 allocs/op
BenchmarkGraphemesMixed/rivo/uniseg-8 2018284 ns/op 17.32 MB/s 0 B/op 0 allocs/op
BenchmarkGraphemesASCII/clipperhouse/uax29-8 8846 ns/op 508.73 MB/s 0 B/op 0 allocs/op
BenchmarkGraphemesASCII/rivo/uniseg-8 366760 ns/op 12.27 MB/s 0 B/op 0 allocs/op
```
### Invalid inputs ### Invalid inputs
+138
View File
@@ -0,0 +1,138 @@
package graphemes
// ansiEscapeLength returns the byte length of a valid 7-bit ANSI escape
// sequence at the start of data, or 0 if none.
//
// Recognized forms (ECMA-48 / ISO 6429):
// - CSI: ESC [ then parameter bytes (0x30-0x3F), intermediate (0x20-0x2F), final (0x40-0x7E)
// - OSC: ESC ] then payload until BEL (0x07), 7-bit ST (ESC \), CAN (0x18), or SUB (0x1A)
// - DCS, SOS, PM, APC: ESC P/X/^/_ then payload until 7-bit ST (ESC \), CAN, or SUB
// - Two-byte: ESC + Fe/Fs (0x40-0x7E excluding above), or Fp (0x30-0x3F), or nF (0x20-0x2F then final)
func ansiEscapeLength[T ~string | ~[]byte](data T) int {
n := len(data)
if n < 2 || data[0] != esc {
return 0
}
b1 := data[1]
switch b1 {
case '[': // CSI
body := csiBodyLength(data[2:])
if body == 0 {
return 0
}
return 2 + body
case ']': // OSC - allows BEL or 7-bit ST terminator
body := oscLength(data[2:])
if body < 0 {
return 0
}
return 2 + body
case 'P', 'X', '^', '_': // DCS, SOS, PM, APC
body := stSequenceLength(data[2:])
if body < 0 {
return 0
}
return 2 + body
}
if b1 >= 0x40 && b1 <= 0x7E {
// Fe/Fs two-byte; [ ] P X ^ _ handled above
return 2
}
if b1 >= 0x30 && b1 <= 0x3F {
// Fp (private) two-byte
return 2
}
if b1 >= 0x20 && b1 <= 0x2F {
// nF: intermediates then one final (0x30-0x7E)
i := 2
for i < n && data[i] >= 0x20 && data[i] <= 0x2F {
i++
}
if i < n && data[i] >= 0x30 && data[i] <= 0x7E {
return i + 1
}
return 0
}
return 0
}
// csiBodyLength returns the length of the CSI body (param/intermediate/final bytes).
// data is the slice after "ESC [".
// Per ECMA-48, the CSI body has the form:
//
// parameters (0x300x3F)*, intermediates (0x200x2F)*, final (0x400x7E)
//
// Once an intermediate byte is seen, subsequent parameter bytes are invalid.
func csiBodyLength[T ~string | ~[]byte](data T) int {
seenIntermediate := false
for i := 0; i < len(data); i++ {
b := data[i]
if b >= 0x30 && b <= 0x3F {
if seenIntermediate {
return 0
}
continue
}
if b >= 0x20 && b <= 0x2F {
seenIntermediate = true
continue
}
if b >= 0x40 && b <= 0x7E {
return i + 1
}
return 0
}
return 0
}
// oscLength returns the length of the OSC body.
// data is the slice after "ESC ]".
//
// Returns:
// - n >= 0: consumed body length (includes BEL/ST terminator when present)
// - -1: not terminated in the provided data
//
// OSC accepts BEL (0x07) or 7-bit ST (ESC \) as terminators by widespread convention.
// Per ECMA-48, CAN (0x18) and SUB (0x1A) cancel the control string; in that
// case they are not part of the OSC sequence length.
func oscLength[T ~string | ~[]byte](data T) int {
for i := 0; i < len(data); i++ {
b := data[i]
if b == bel {
return i + 1
}
if b == can || b == sub {
return i
}
if b == esc && i+1 < len(data) && data[i+1] == '\\' {
return i + 2
}
}
return -1
}
// stSequenceLength returns the length of a control-string body.
// data is the slice after "ESC x".
//
// Returns:
// - n >= 0: consumed body length (includes ST terminator when present)
// - -1: not terminated in the provided data
//
// Used for DCS, SOS, PM, and APC, which per ECMA-48 terminate with ST.
// ST here is the 7-bit form (ESC \).
// CAN (0x18) and SUB (0x1A) cancel the control string; in that case they are
// not part of the sequence length.
func stSequenceLength[T ~string | ~[]byte](data T) int {
for i := 0; i < len(data); i++ {
if data[i] == can || data[i] == sub {
return i
}
if data[i] == esc && i+1 < len(data) && data[i+1] == '\\' {
return i + 2
}
}
return -1
}
+79
View File
@@ -0,0 +1,79 @@
package graphemes
// ansiEscapeLength8Bit returns the byte length of a valid 8-bit C1 ANSI
// sequence at the start of data, or 0 if none.
//
// Recognized forms (ECMA-48 / ISO 6429):
// - C1 CSI (0x9B) body as parameter/intermediate/final bytes
// - C1 OSC (0x9D) body terminated by BEL, C1 ST, CAN, or SUB
// - C1 DCS/SOS/PM/APC (0x90/0x98/0x9E/0x9F) body terminated by C1 ST, CAN, or SUB
// - Standalone C1 controls (0x80..0x9F not listed above): single byte
func ansiEscapeLength8Bit[T ~string | ~[]byte](data T) int {
if len(data) == 0 {
return 0
}
switch data[0] {
case 0x9B: // C1 CSI
body := csiBodyLength(data[1:])
if body == 0 {
return 0
}
return 1 + body
case 0x9D: // C1 OSC
body := oscLengthC1(data[1:])
if body < 0 {
return 0
}
return 1 + body
case 0x90, 0x98, 0x9E, 0x9F: // C1 DCS, SOS, PM, APC
body := stSequenceLengthC1(data[1:])
if body < 0 {
return 0
}
return 1 + body
default:
if data[0] >= 0x80 && data[0] <= 0x9F {
return 1
}
}
return 0
}
// oscLengthC1 returns the length of a C1 OSC body.
// data is the slice after the C1 OSC initiator (0x9D).
//
// Returns:
// - n >= 0: consumed body length (includes BEL/ST terminator when present)
// - -1: not terminated in the provided data
//
// Terminators: BEL (0x07) or C1 ST (0x9C).
// CAN (0x18) and SUB (0x1A) cancel the control string.
func oscLengthC1[T ~string | ~[]byte](data T) int {
for i := 0; i < len(data); i++ {
b := data[i]
if b == bel || b == st {
return i + 1
}
if b == can || b == sub {
return i
}
}
return -1
}
// stSequenceLengthC1 parses DCS/SOS/PM/APC bodies that terminate with C1 ST
// (0x9C), or are canceled by CAN/SUB.
func stSequenceLengthC1[T ~string | ~[]byte](data T) int {
for i := 0; i < len(data); i++ {
b := data[i]
if b == can || b == sub {
return i
}
if b == st {
return i + 1
}
}
return -1
}
+130 -14
View File
@@ -1,9 +1,44 @@
package graphemes package graphemes
import "github.com/clipperhouse/uax29/v2/internal/iterators" import "unicode/utf8"
type Iterator[T iterators.Stringish] struct { // FromString returns an iterator for the grapheme clusters in the input string.
*iterators.Iterator[T] // Iterate while Next() is true, and access the grapheme via Value().
func FromString(s string) *Iterator[string] {
return &Iterator[string]{
split: splitFuncString,
data: s,
}
}
// FromBytes returns an iterator for the grapheme clusters in the input bytes.
// Iterate while Next() is true, and access the grapheme via Value().
func FromBytes(b []byte) *Iterator[[]byte] {
return &Iterator[[]byte]{
split: splitFuncBytes,
data: b,
}
}
// Iterator is a generic iterator for grapheme clusters in strings or byte slices,
// with an ASCII hot path optimization.
type Iterator[T ~string | ~[]byte] struct {
split func(T, bool) (int, T, error)
data T
pos int
start int
// AnsiEscapeSequences treats 7-bit ANSI escape sequences (ECMA-48) as
// single grapheme clusters when true. The default is false.
//
// 8-bit controls are not enabled by this option. See [AnsiEscapeSequences8Bit].
AnsiEscapeSequences bool
// AnsiEscapeSequences8Bit treats 8-bit C1 ANSI escape sequences (ECMA-48) as single
// grapheme clusters when true. The default is false.
//
// 8-bit control bytes are not UTF-8 encoded, i.e. not valid UTF-8. If you
// choose this option, you are choosing to interpret non-UTF-8 data, caveat
// emptor.
AnsiEscapeSequences8Bit bool
} }
var ( var (
@@ -11,18 +46,99 @@ var (
splitFuncBytes = splitFunc[[]byte] splitFuncBytes = splitFunc[[]byte]
) )
// FromString returns an iterator for the grapheme clusters in the input string. const (
// Iterate while Next() is true, and access the grapheme via Value(). esc = 0x1B
func FromString(s string) Iterator[string] { cr = 0x0D
return Iterator[string]{ bel = 0x07
iterators.New(splitFuncString, s), can = 0x18
sub = 0x1A
st = 0x9C
)
// Next advances the iterator to the next grapheme cluster.
// Returns false when there are no more grapheme clusters.
func (iter *Iterator[T]) Next() bool {
if iter.pos >= len(iter.data) {
return false
} }
iter.start = iter.pos
b := iter.data[iter.pos]
if iter.AnsiEscapeSequences && b == esc {
if a := ansiEscapeLength(iter.data[iter.pos:]); a > 0 {
iter.pos += a
return true
}
}
if iter.AnsiEscapeSequences8Bit && b >= 0x80 && b <= 0x9F {
if a := ansiEscapeLength8Bit(iter.data[iter.pos:]); a > 0 {
iter.pos += a
return true
}
}
// ASCII hot path: any ASCII is one grapheme when next byte is ASCII or end.
if b < utf8.RuneSelf && b != cr {
if iter.pos+1 >= len(iter.data) || iter.data[iter.pos+1] < utf8.RuneSelf {
iter.pos++
return true
}
}
// Fall back to UAX29 grapheme parsing
remaining := iter.data[iter.pos:]
advance, _, err := iter.split(remaining, true)
if err != nil {
panic(err)
}
if advance <= 0 {
panic("splitFunc returned a zero or negative advance")
}
iter.pos += advance
if iter.pos > len(iter.data) {
panic("splitFunc advanced beyond end of data")
}
return true
} }
// FromBytes returns an iterator for the grapheme clusters in the input bytes. // Value returns the current grapheme cluster.
// Iterate while Next() is true, and access the grapheme via Value(). func (iter *Iterator[T]) Value() T {
func FromBytes(b []byte) Iterator[[]byte] { return iter.data[iter.start:iter.pos]
return Iterator[[]byte]{ }
iterators.New(splitFuncBytes, b),
} // Start returns the byte position of the current grapheme in the original data.
func (iter *Iterator[T]) Start() int {
return iter.start
}
// End returns the byte position after the current grapheme in the original data.
func (iter *Iterator[T]) End() int {
return iter.pos
}
// Reset resets the iterator to the beginning of the data.
func (iter *Iterator[T]) Reset() {
iter.start = 0
iter.pos = 0
}
// SetText sets the data for the iterator to operate on, and resets all state.
func (iter *Iterator[T]) SetText(data T) {
iter.data = data
iter.start = 0
iter.pos = 0
}
// First returns the first grapheme cluster without advancing the iterator.
func (iter *Iterator[T]) First() T {
if len(iter.data) == 0 {
return iter.data
}
// Use a copy to leverage Next()'s ASCII optimization
cp := *iter
cp.pos = 0
cp.start = 0
cp.Next()
return cp.Value()
} }
+39 -8
View File
@@ -2,8 +2,6 @@ package graphemes
import ( import (
"bufio" "bufio"
"github.com/clipperhouse/uax29/v2/internal/iterators"
) )
// is determines if lookup intersects propert(ies) // is determines if lookup intersects propert(ies)
@@ -13,12 +11,22 @@ func (lookup property) is(properties property) bool {
const _Ignore = _Extend const _Ignore = _Extend
// incbState tracks state for GB9c rule (Indic conjunct clusters)
// Pattern: Consonant (Extend|Linker)* Linker (Extend|Linker)* × Consonant
type incbState int
const (
incbNone incbState = iota // initial/reset
incbConsonant // seen Consonant, awaiting Linker
incbLinker // seen Consonant and Linker (conjunct ready)
)
// SplitFunc is a bufio.SplitFunc implementation of Unicode grapheme cluster segmentation, for use with bufio.Scanner. // SplitFunc is a bufio.SplitFunc implementation of Unicode grapheme cluster segmentation, for use with bufio.Scanner.
// //
// See https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries. // See https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries.
var SplitFunc bufio.SplitFunc = splitFunc[[]byte] var SplitFunc bufio.SplitFunc = splitFunc[[]byte]
func splitFunc[T iterators.Stringish](data T, atEOF bool) (advance int, token T, err error) { func splitFunc[T ~string | ~[]byte](data T, atEOF bool) (advance int, token T, err error) {
var empty T var empty T
if len(data) == 0 { if len(data) == 0 {
return 0, empty, nil return 0, empty, nil
@@ -30,6 +38,9 @@ func splitFunc[T iterators.Stringish](data T, atEOF bool) (advance int, token T,
var lastLastExIgnore property = 0 // "last one before that" var lastLastExIgnore property = 0 // "last one before that"
var regionalIndicatorCount int var regionalIndicatorCount int
// GB9c state: tracking Indic conjunct clusters
var incb incbState
// Rules are usually of the form Cat1 × Cat2; "current" refers to the first property // Rules are usually of the form Cat1 × Cat2; "current" refers to the first property
// to the right of the ×, from which we look back or forward // to the right of the ×, from which we look back or forward
@@ -76,6 +87,23 @@ func splitFunc[T iterators.Stringish](data T, atEOF bool) (advance int, token T,
lastExIgnore = last lastExIgnore = last
} }
// Update GB9c state based on what we just advanced past
if last.is(_InCBConsonant | _InCBLinker | _InCBExtend) {
switch {
case last.is(_InCBConsonant):
if incb != incbLinker {
incb = incbConsonant
}
case last.is(_InCBLinker):
if incb >= incbConsonant {
incb = incbLinker
}
// case last.is(_InCBExtend): stay in current state
}
} else {
incb = incbNone
}
current, w = lookup(data[pos:]) current, w = lookup(data[pos:])
if w == 0 { if w == 0 {
if atEOF { if atEOF {
@@ -141,11 +169,14 @@ func splitFunc[T iterators.Stringish](data T, atEOF bool) (advance int, token T,
} }
// https://unicode.org/reports/tr29/#GB9c // https://unicode.org/reports/tr29/#GB9c
// TODO(clipperhouse): // Do not break within certain combinations with Indic_Conjunct_Break (InCB)=Linker.
// It appears to be added in Unicode 15.1.0: if incb == incbLinker && current.is(_InCBConsonant) {
// https://unicode.org/versions/Unicode15.1.0/#Migration // After matching the pattern, reset state to start tracking a new pattern
// This package currently supports Unicode 15.0.0, so // The current Consonant becomes the start of the new pattern
// out of scope for now incb = incbConsonant
pos += w
continue
}
// https://unicode.org/reports/tr29/#GB11 // https://unicode.org/reports/tr29/#GB11
if current.is(_ExtendedPictographic) && last.is(_ZWJ) && lastLastExIgnore.is(_ExtendedPictographic) { if current.is(_ExtendedPictographic) && last.is(_ZWJ) && lastLastExIgnore.is(_ExtendedPictographic) {
+1323 -1015
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More