Skip to content

Commit

Permalink
Merge pull request #108 from msladek/clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
hazcod authored Jan 9, 2022
2 parents dfb5f83 + 7ba3cd0 commit afdb4a9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/enpasscli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
s "sort"
"strings"

"github.com/atotto/clipboard"
"github.com/hazcod/enpass-cli/pkg/clipboard"
"github.com/hazcod/enpass-cli/pkg/enpass"
"github.com/miquella/ask"
"github.com/sirupsen/logrus"
Expand Down
11 changes: 11 additions & 0 deletions pkg/clipboard/clipboard.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package clipboard

var (
// using X selection primary if set to true and os allows for it
Primary bool
)

// WriteAll : writes to the clipboard
func WriteAll(text string) error {
return writeAll(text)
}
9 changes: 9 additions & 0 deletions pkg/clipboard/clipboard_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package clipboard

import (
"github.com/atotto/clipboard"
)

func writeAll(text string) error {
return clipboard.WriteAll(text)
}
10 changes: 10 additions & 0 deletions pkg/clipboard/clipboard_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package clipboard

import (
"github.com/atotto/clipboard"
)

func writeAll(text string) error {
clipboard.Primary = Primary
return clipboard.WriteAll(text)
}

0 comments on commit afdb4a9

Please sign in to comment.