Skip to content

Commit 6d80359

Browse files
authored
Remove clip functionality, add notes for alternatives (#40)
* Remove clip functionality, add notes for alternatives * Go mod tidy
1 parent 6ab7bf7 commit 6d80359

8 files changed

Lines changed: 16 additions & 140 deletions

File tree

.goreleaser.yaml

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,13 @@ version: 2
33
before:
44
hooks:
55
- go mod tidy
6-
76
builds:
8-
- id: macos
9-
goos:
10-
- darwin
11-
goarch:
12-
- amd64
13-
- arm64
14-
env:
15-
- CGO_ENABLED=1
16-
# Cross compile settings are disabled as MacOS builds can currently only
17-
# be built natively
18-
# - >-
19-
# {{- if eq .Arch "amd64" }}CC=o64-clang
20-
# {{- else }}CC=oa64-clang
21-
# {{ end }}
22-
# - >-
23-
# {{- if eq .Arch "amd64" }}CCX=o64-clang++
24-
# {{- else }}CCX=oa64-clang++
25-
# {{ end }}
26-
flags:
27-
- -trimpath
28-
29-
- id: linux
7+
- env:
8+
- CGO_ENABLED=0
309
goos:
3110
- linux
32-
goarch:
33-
- amd64
34-
- arm64
35-
env:
36-
- CGO_ENABLED=1
37-
- >-
38-
{{- if eq .Arch "amd64" }}CC=x86_64-linux-gnu-gcc
39-
{{- else }}CC=aarch64-linux-gnu-gcc
40-
{{ end }}
41-
- >-
42-
{{- if eq .Arch "amd64" }}CCX=x86_64-linux-gnu-g++
43-
{{- else }}CCX=aarch64-linux-gnu-g++
44-
{{ end }}
45-
flags:
46-
- -trimpath
47-
48-
- id: windows
49-
goos:
5011
- windows
51-
goarch:
52-
- amd64
53-
- 386
54-
env:
55-
- CGO_ENABLED=0
56-
flags:
57-
- -trimpath
12+
- darwin
5813

5914
archives:
6015
- format: tar.gz
@@ -69,13 +24,10 @@ archives:
6924
format_overrides:
7025
- goos: windows
7126
format: zip
72-
7327
checksum:
7428
name_template: 'checksums.txt'
75-
7629
snapshot:
7730
name_template: "{{ incpatch .Version }}-next"
78-
7931
changelog:
8032
sort: asc
8133
filters:

Dockerfile.build

Lines changed: 0 additions & 5 deletions
This file was deleted.

Makefile

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
1-
.PHONY: clean build-linux-windows build-macos release
1+
.PHONY: clean build release
22

33
clean:
4-
rm -rf dist/ dist-linux-win/ dist-macos/
4+
rm -rf dist/
55

6-
# Build Linux & Windows versions in Docker
7-
build-linux-windows:
8-
docker build -f Dockerfile.build -t goreleaser-cross-x11 .
9-
docker run --rm \
10-
-v "$$PWD:/app" -w /app goreleaser-cross-x11 \
11-
build --config .goreleaser.yaml --id linux --id windows --snapshot
12-
mv dist/ dist-linux-win/
6+
build:
7+
docker build -t pleasant-cli .
138

14-
# Build Mac versions natively (must be ran on MacOS)
15-
build-macos:
16-
goreleaser build --config .goreleaser.yaml --id macos --snapshot
17-
mv dist/ dist-macos/
18-
19-
# Merge dist folders into one
20-
merge:
21-
mkdir -p dist/
22-
rsync -a --exclude=artifacts.json --exclude=config.yaml dist-linux-win/ dist/
23-
rsync -a --exclude=artifacts.json --exclude=config.yaml dist-macos/ dist/
24-
jq -s 'add | unique_by(.name, .path)' \
25-
dist-linux-win/artifacts.json dist-macos/artifacts.json > dist/artifacts.json
26-
yq eval ' .builds as $$b1 | (load("dist-macos/config.yaml") | .builds) as $$b2 | .builds = ($$b1 + $$b2)' dist-linux-win/config.yaml > dist/config.yaml
27-
28-
# Release the built artifacts
29-
release: clean build-linux build-native
30-
goreleaser release --config .goreleaser.yaml --skip=build
9+
release: clean
10+
goreleaser release

README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,21 +168,17 @@ For `entry` commands, both entries and folders are returned. For `folder` comman
168168

169169
## Clipboard functionality
170170

171-
If you are retrieving a username or password of an entry, it is possible to have Pleasant CLI copy the output directly to your clipboard. This is supported on the following platforms:
171+
I've made the decision to remove this functionality from Pleasant CLI. As the integration requires CGO, creating a reliable build process for all OS types and architectures proved very difficult (mostly driven by MacOS). In order to keep this project maintainable, it was removed.
172172

173-
- macOS
174-
- Windows
175-
- Linux - needs X11 dev package, install either `libx11-dev`, `xorg-dev` or `libX11-devel` to make it work
173+
If you still want the same functionality, I would recommend using a separate CLI command and pipe the output of any Pleasant CLI command into it. Here are a few examples:
176174

177-
It is NOT supported on:
175+
- [gclip](https://github.com/golang-design/clipboard)
176+
- [gocopy](https://github.com/atotto/clipboard)
178177

179-
- WSL2
178+
Example (with `gocopy`):
180179

181-
Examples:
182-
183-
```
184-
$ pleasant-cli get entry --path Root/MyFolder/MyEntry --username --clip
185-
$ pleasant-cli get entry --path Root/MyFolder/MyEntry --password --clip
180+
```bash
181+
$ pleasant-cli get entry --path Root/MyFolder/MyEntry --password | gocopy
186182
```
187183

188184
## Docker image

cmd/get-entry.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@ A path must be absolute and starts with 'Root/', e.g. 'Root/Folder1/Folder2/Entr
1414
1515
To get the username of an entry, use --username.
1616
To get the password of an entry, use --password.
17-
For these two options, if you include the flag --clip, the output
18-
will be copied to your clipboard instead.
1917
2018
To get the attachments of an entry, use --attachments.
2119
2220
Examples:
2321
pleasant-cli get entry --id <id>
2422
pleasant-cli get entry --path <path>
2523
pleasant-cli get entry --id <id> --username
26-
pleasant-cli get entry --id <id> --password --clip
2724
pleasant-cli get entry --path <path> --attachments`,
2825
Run: func(cmd *cobra.Command, args []string) {
2926
if !pleasant.CheckPrerequisites(pleasant.IsServerUrlSet(), pleasant.IsTokenValid()) {
@@ -85,26 +82,8 @@ pleasant-cli get entry --path <path> --attachments`,
8582
pleasant.ExitFatal(err)
8683
}
8784

88-
if cmd.Flags().Changed("clip") {
89-
err := pleasant.CopyToClipboard(en.Username)
90-
if err != nil {
91-
pleasant.ExitFatal(err)
92-
}
93-
94-
pleasant.Exit("Username copied to clipboard")
95-
}
96-
9785
pleasant.Exit(en.Username)
9886
case cmd.Flags().Changed("password"):
99-
if cmd.Flags().Changed("clip") {
100-
err := pleasant.CopyToClipboard(pleasant.Unescape(pleasant.TrimDoubleQuotes(entry)))
101-
if err != nil {
102-
pleasant.ExitFatal(err)
103-
}
104-
105-
pleasant.Exit("Password copied to clipboard")
106-
}
107-
10887
pleasant.Exit(pleasant.Unescape(pleasant.TrimDoubleQuotes(entry)))
10988
default:
11089
pleasant.Exit(entry)
@@ -129,6 +108,4 @@ func init() {
129108
getEntryCmd.Flags().Bool("attachments", false, "Gets the attachments of the entry")
130109
getEntryCmd.Flags().Bool("useraccess", false, "Gets the users that have access to the entry")
131110
getEntryCmd.MarkFlagsMutuallyExclusive("username", "password", "attachments", "useraccess")
132-
133-
getEntryCmd.Flags().Bool("clip", false, "Copy the output to the clipboard instead (username or password)")
134111
}

go.mod

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ toolchain go1.24.2
77
require (
88
github.com/spf13/cobra v1.9.1
99
github.com/spf13/viper v1.20.1
10-
golang.design/x/clipboard v0.7.1
1110
golang.org/x/term v0.32.0
1211
gopkg.in/yaml.v3 v3.0.1
1312
)
@@ -24,9 +23,6 @@ require (
2423
github.com/spf13/pflag v1.0.6 // indirect
2524
github.com/subosito/gotenv v1.6.0 // indirect
2625
go.uber.org/multierr v1.11.0 // indirect
27-
golang.org/x/exp/shiny v0.0.0-20250620022241-b7579e27df2b // indirect
28-
golang.org/x/image v0.28.0 // indirect
29-
golang.org/x/mobile v0.0.0-20250606033058-a2a15c67f36f // indirect
3026
golang.org/x/sys v0.33.0 // indirect
3127
golang.org/x/text v0.26.0 // indirect
3228
)

go.sum

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
4242
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
4343
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
4444
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
45-
golang.design/x/clipboard v0.7.1 h1:OEG3CmcYRBNnRwpDp7+uWLiZi3hrMRJpE9JkkkYtz2c=
46-
golang.design/x/clipboard v0.7.1/go.mod h1:i5SiIqj0wLFw9P/1D7vfILFK0KHMk7ydE72HRrUIgkg=
47-
golang.org/x/exp/shiny v0.0.0-20250620022241-b7579e27df2b h1:zELBzk+7ERc6m8BxhzU2VYjp03wlEvi+cIgYQR5H3CI=
48-
golang.org/x/exp/shiny v0.0.0-20250620022241-b7579e27df2b/go.mod h1:ygj7T6vSGhhm/9yTpOQQNvuAUFziTH7RUiH74EoE2C8=
49-
golang.org/x/image v0.28.0 h1:gdem5JW1OLS4FbkWgLO+7ZeFzYtL3xClb97GaUzYMFE=
50-
golang.org/x/image v0.28.0/go.mod h1:GUJYXtnGKEUgggyzh+Vxt+AviiCcyiwpsl8iQ8MvwGY=
51-
golang.org/x/mobile v0.0.0-20250606033058-a2a15c67f36f h1:/n+PL2HlfqeSiDCuhdBbRNlGS/g2fM4OHufalHaTVG8=
52-
golang.org/x/mobile v0.0.0-20250606033058-a2a15c67f36f/go.mod h1:ESkJ836Z6LpG6mTVAhA48LpfW/8fNR0ifStlH2axyfg=
5345
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
5446
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
5547
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=

pleasant/pleasant.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"strings"
99

1010
"github.com/spf13/cobra"
11-
"golang.design/x/clipboard"
1211
)
1312

1413
const (
@@ -423,14 +422,3 @@ func DuplicateFolderId(baseUrl, jsonString, bearerToken string) (string, error)
423422

424423
return "", nil
425424
}
426-
427-
func CopyToClipboard(text string) error {
428-
err := clipboard.Init()
429-
if err != nil {
430-
return err
431-
}
432-
433-
clipboard.Write(clipboard.FmtText, []byte(text))
434-
435-
return nil
436-
}

0 commit comments

Comments
 (0)