summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortheimpostor <sahirhoda@gmail.com>2024-08-18 11:43:07 -0500
committertheimpostor <sahirhoda@gmail.com>2024-08-18 11:43:07 -0500
commit2f42995ff3cceea702f9d92bb1d505600955dcd4 (patch)
treebc5a75510233517fb160ba69ff2b9df453344dac
parent2a3415446574c63d7912c2be2f7493eb369435a4 (diff)
check stdin readable and update readme
-rw-r--r--README.md33
-rw-r--r--go.mod1
-rw-r--r--go.sum3
3 files changed, 24 insertions, 13 deletions
diff --git a/README.md b/README.md
index e018c5d..48d462f 100644
--- a/README.md
+++ b/README.md
@@ -5,15 +5,27 @@ System clipboard access includes writing (i.e. copy) and reading (i.e. paste), e
## Examples
-```
-❯ echo asdf | osc copy
+#### Copying to the clipboard
+```
+❯ echo -n asdf | osc copy
# String 'asdf' copied to clipboard
+```
+#### Pasting from the clipboard
+
+```
❯ osc paste
asdf
```
+#### Clearing the clipboard
+
+```
+❯ osc copy /dev/null
+# Clipboard cleared
+```
+
## Usage
```
@@ -30,13 +42,13 @@ Available Commands:
version Outputs version information
Flags:
- -d, --device string select device
- -h, --help help for osc
- -l, --log string write logs to file
- -v, --verbose verbose logging
+ -d, --device string select device (default "/dev/tty")
+ -h, --help help for osc
+ -l, --log string write logs to file
+ -t, --timeout float tty read timeout in seconds (default 5)
+ -v, --verbose verbose logging
Use "osc [command] --help" for more information about a command.
-
```
## Compatibility
@@ -57,8 +69,7 @@ Terminal | Terminal OS | Shell OS | Copy | Paste | Notes
#### Terminal Multiplexer support
-Using [alacritty](https://github.com/alacritty/alacritty) as the terminal,
-default configuration options for multiplexer:
+Using [alacritty](https://github.com/alacritty/alacritty) as the terminal:
Terminal Multiplexer | Copy | Paste | Notes
--- | --- | --- | ---
@@ -74,10 +85,6 @@ go install -v github.com/theimpostor/osc@latest
This will install the latest version of osc to `$GOPATH/bin`. To find out where `$GOPATH` is, run `go env GOPATH`
-## TODO
-
-- [ ] [copy] check is stdin is readable
-
## For neovim
- set init.lua
diff --git a/go.mod b/go.mod
index 63c7f64..320321e 100644
--- a/go.mod
+++ b/go.mod
@@ -7,6 +7,7 @@ toolchain go1.23.0
require (
github.com/gdamore/tcell/v2 v2.7.4
github.com/jba/slog v0.2.0
+ github.com/mattn/go-isatty v0.0.20
github.com/spf13/cobra v1.8.1
)
diff --git a/go.sum b/go.sum
index dd6ac7c..094b003 100644
--- a/go.sum
+++ b/go.sum
@@ -10,6 +10,8 @@ github.com/jba/slog v0.2.0 h1:jI0U5NRR3EJKGsbeEVpItJNogk0c4RMeCl7vJmogCJI=
github.com/jba/slog v0.2.0/go.mod h1:0Dh7Vyz3Td68Z1OwzadfincHwr7v+PpzadrS2Jua338=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
+github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
+github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
@@ -40,6 +42,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=