From 43ec9362917aac3bcd2df5188ca1e408f70372b4 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 12 Feb 2020 13:59:21 +0200 Subject: [PATCH] copy to clipboard after upload --- commands/create.go | 3 +++ go.mod | 1 + go.sum | 2 ++ 3 files changed, 6 insertions(+) diff --git a/commands/create.go b/commands/create.go index 17f27a2..14b7c8a 100644 --- a/commands/create.go +++ b/commands/create.go @@ -7,6 +7,7 @@ import ( "io/ioutil" "os" + "github.com/atotto/clipboard" "github.com/jozsefsallai/fastbin-cli/config" "github.com/jozsefsallai/fastbin-cli/utils" "github.com/urfave/cli" @@ -18,6 +19,8 @@ func printUrls(key string) { documentURL := conf.Server + "/" + key rawURL := conf.Server + "/raw/" + key + clipboard.WriteAll(documentURL) + fmt.Println("Snippet uploaded successfully!") fmt.Println("URL:", documentURL) fmt.Println("Raw:", rawURL) diff --git a/go.mod b/go.mod index d5b6f65..7e94e8d 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/jozsefsallai/fastbin-cli go 1.13 require ( + github.com/atotto/clipboard v0.1.2 github.com/mitchellh/go-homedir v1.1.0 github.com/urfave/cli v1.22.0 ) diff --git a/go.sum b/go.sum index 9cfedb4..2a757ce 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY= +github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=