summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortheimpostor <sahirhoda@gmail.com>2023-08-03 21:52:18 -0500
committertheimpostor <sahirhoda@gmail.com>2023-08-03 21:52:18 -0500
commit3db0c511fc875041f6c794a9c6677b5ded4ffc4d (patch)
tree04d41c42319c1f490b5905559a2170015849821c
parentb0591174dc3549cc91340df46604ab49df35b11b (diff)
Update readme, arg num validation
-rw-r--r--README.md48
-rw-r--r--main.go2
2 files changed, 26 insertions, 24 deletions
diff --git a/README.md b/README.md
index fb1b649..2e78455 100644
--- a/README.md
+++ b/README.md
@@ -3,32 +3,39 @@ A command line tool to access the system clipboard from anywhere on the command
System clipboard access includes writing (i.e. copy) and reading (i.e. paste), even while logged into a remote machine via ssh.
-## Usage
+## Examples
+
```
-Reads or writes the system clipboard using the ANSI OSC52 escape sequence.
+❯ echo asdf | osc copy
-Usage:
+# String 'asdf' copied to clipboard
-COPY mode (default):
+❯ osc paste
+asdf
+```
+
+## Usage
- osc52 [file1 [...fileN]]
+```
+Reads or writes the system clipboard using the ANSI OSC52 escape sequence.
-With no arguments, will read from stdin.
+Usage:
+ osc [command]
-PASTE mode:
+Available Commands:
+ completion Generate the autocompletion script for the specified shell
+ copy Copies input to the system clipboard
+ help Help about any command
+ paste Outputs system clipboard contents to stdout
+ version Outputs version information
- osc52 --paste
+Flags:
+ -h, --help help for osc
+ -l, --log string write logs to file
+ -v, --verbose verbose logging
-Outputs clipboard contents to stdout.
+Use "osc [command] --help" for more information about a command.
-Options:
- -logFile string
- redirect logs to file
- -paste
- paste operation
- -v verbose logging
- -verbose
- verbose logging
```
## Compatibility
@@ -59,17 +66,10 @@ Terminal Multiplexer | Copy | Paste | Notes
## Installation
-#### go 1.16 or later:
-
```
go install -v github.com/theimpostor/osc@latest
```
-#### go 1.15 or earlier:
-```
-GO111MODULE=on go get 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
diff --git a/main.go b/main.go
index 18314b7..9cd7fa2 100644
--- a/main.go
+++ b/main.go
@@ -246,6 +246,7 @@ var pasteCmd = &cobra.Command{
Long: `Outputs system clipboard contents to stdout. Usage:
osc paste`,
+ Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
logfile := initLogging()
defer closeSilently(logfile)
@@ -258,6 +259,7 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Outputs version information",
Long: `Outputs version information`,
+ Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
if info, ok := debug.ReadBuildInfo(); !ok {
fmt.Println(`Unable to obtain build info.`)