Skip to content

Commit

Permalink
Merge pull request #294 from upvestco/goreleaser-cross-compile
Browse files Browse the repository at this point in the history
(feat) change clipboard lib
  • Loading branch information
upvest-mike authored Nov 27, 2024
2 parents acd39f5 + 531a148 commit 24d1a21
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ builds:
ldflags:
- -s -w -X github.com/upvestco/httpsignature-proxy/cmd.version={{.Version}} -X github.com/upvestco/httpsignature-proxy/cmd.commit={{.Commit}} -X github.com/upvestco/httpsignature-proxy/cmd.date={{.Date}} -X github.com/upvestco/httpsignature-proxy/cmd.builtBy=goreleaser
env:
- CGO_ENABLED=1
- CGO_ENABLED=0
- GO111MODULE=on
mod_timestamp: "{{ .CommitTimestamp }}"
archives:
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ require (
github.com/gookit/color v1.5.4
github.com/neilotoole/jsoncolor v0.7.1
github.com/nsf/termbox-go v1.1.1
github.com/tiagomelo/go-clipboard v0.1.1
github.com/valyala/fastjson v1.6.4
golang.design/x/clipboard v0.7.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
)

Expand All @@ -50,9 +50,6 @@ require (
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp/shiny v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
10 changes: 2 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/tiagomelo/go-clipboard v0.1.1 h1:nddQ5DsEnKW0KdzTILhbLpSq3e9y2dkJXEOtsMs6H7A=
github.com/tiagomelo/go-clipboard v0.1.1/go.mod h1:kXtjJBIMimZaGbxmcKZ8+JqK+acSNf5tAJiChlZBOr8=
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
Expand All @@ -103,18 +105,10 @@ go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
golang.design/x/clipboard v0.7.0 h1:4Je8M/ys9AJumVnl8m+rZnIvstSnYj1fvzqYrU3TXvo=
golang.design/x/clipboard v0.7.0/go.mod h1:PQIvqYO9GP29yINEfsEn5zSQKAz3UgXmZKzDA6dnq2E=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/exp/shiny v0.0.0-20241009180824-f66d83c29e7c h1:jTMrjjZRcSH/BDxWhXCP6OWsfVgmnwI7J+F4/nyVXaU=
golang.org/x/exp/shiny v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:3F+MieQB7dRYLTmnncoFbb1crS5lfQoTfDgQy6K4N0o=
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a h1:sYbmY3FwUWCBTodZL1S3JUuOvaW6kM2o+clDzzDNBWg=
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a/go.mod h1:Ede7gF0KGoHlj822RtphAHK1jLdrcuRBZg0sF1Q+SPc=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211110154304-99a53858aa08/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
7 changes: 0 additions & 7 deletions service/ui/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"fmt"

tb "github.com/nsf/termbox-go"
"golang.design/x/clipboard"
)

type Console struct {
Expand All @@ -34,12 +33,6 @@ func (c *Console) Size() (int, int) {

func Create(fg, bg tb.Attribute) *Console {

err := clipboard.Init()
if err != nil {
fmt.Println(err)
panic(err)
}

if err := tb.Init(); err != nil {
fmt.Println(err)
panic(err)
Expand Down
17 changes: 13 additions & 4 deletions service/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (

"github.com/google/uuid"
tb "github.com/nsf/termbox-go"
"github.com/tiagomelo/go-clipboard/clipboard"
"github.com/upvestco/httpsignature-proxy/service/logger"
"github.com/upvestco/httpsignature-proxy/service/ui/elements"
"github.com/upvestco/httpsignature-proxy/service/ui/window"
"golang.design/x/clipboard"
)

const (
Expand Down Expand Up @@ -213,7 +213,10 @@ func Create(onClose func()) {
buf.WriteString(line)
buf.WriteString("\n")
}
clipboard.Write(clipboard.FmtText, buf.Bytes())
c := clipboard.New()
if err := c.CopyText(buf.String()); err != nil {
AddLogs(err.Error())
}
})
hLine.Add(copyHeadersButton)

Expand Down Expand Up @@ -243,7 +246,10 @@ func Create(onClose func()) {
if selected == nil {
return
}
clipboard.Write(clipboard.FmtText, selected.source)
c := clipboard.New()
if err := c.CopyText(string(selected.source)); err != nil {
AddLogs(err.Error())
}
})
hLine.Add(copyEventButton)

Expand Down Expand Up @@ -274,7 +280,10 @@ func Create(onClose func()) {
for _, item := range logsList.GetItems() {
b.WriteString(item.String() + "\n")
}
clipboard.Write(clipboard.FmtText, b.Bytes())
c := clipboard.New()
if err := c.CopyText(b.String()); err != nil {
AddLogs(err.Error())
}
})

mainFrame.Add(copyLogsButton)
Expand Down

0 comments on commit 24d1a21

Please sign in to comment.