From e8f4fef41c019714f88a81cae9cb674e94ba878a Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Wed, 22 Jan 2025 23:12:42 +0100 Subject: [PATCH] fix #37: make yank portable --- lib/printer.go | 2 +- lib/ya_darwin.go | 8 ++++++++ lib/ya_unix.go | 9 +++++++++ lib/ya_windows.go | 8 ++++++++ tablizer.1 | 4 ++-- 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 lib/ya_darwin.go create mode 100644 lib/ya_unix.go create mode 100644 lib/ya_windows.go diff --git a/lib/printer.go b/lib/printer.go index cc95238..43ee535 100644 --- a/lib/printer.go +++ b/lib/printer.go @@ -285,7 +285,7 @@ func yankColumns(conf cfg.Config, data *Tabdata) { } if yank != "" { - clipboard.Primary = true // unix + setprimary() if err := clipboard.WriteAll(yank); err != nil { log.Fatalln("error writing string to clipboard:", err) } diff --git a/lib/ya_darwin.go b/lib/ya_darwin.go new file mode 100644 index 0000000..2e7f149 --- /dev/null +++ b/lib/ya_darwin.go @@ -0,0 +1,8 @@ +// +build darwin + +package lib + +import "github.com/atotto/clipboard" + +func setprimary() { +} diff --git a/lib/ya_unix.go b/lib/ya_unix.go new file mode 100644 index 0000000..6f05680 --- /dev/null +++ b/lib/ya_unix.go @@ -0,0 +1,9 @@ +// +build freebsd linux netbsd openbsd solaris dragonfly + +package lib + +import "github.com/atotto/clipboard" + +func setprimary() { + clipboard.Primary = true +} diff --git a/lib/ya_windows.go b/lib/ya_windows.go new file mode 100644 index 0000000..4caae39 --- /dev/null +++ b/lib/ya_windows.go @@ -0,0 +1,8 @@ +// +build windows + +package lib + +import "github.com/atotto/clipboard" + +func setprimary() { +} diff --git a/tablizer.1 b/tablizer.1 index 73dd6b4..e3f1aad 100644 --- a/tablizer.1 +++ b/tablizer.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "TABLIZER 1" -.TH TABLIZER 1 "2025-01-15" "1" "User Commands" +.TH TABLIZER 1 "2025-01-22" "1" "User Commands" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l