From 76f0966aff6fdae8cb4768d12bde46d01df013f9 Mon Sep 17 00:00:00 2001 From: hyrodium Date: Tue, 15 Jun 2021 22:33:11 +0900 Subject: [PATCH 1/4] update error handling for osascript --- src/_osascript.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_osascript.jl b/src/_osascript.jl index fc5e59b..489a9fe 100644 --- a/src/_osascript.jl +++ b/src/_osascript.jl @@ -9,7 +9,7 @@ function _osascript() path_png = joinpath(dir, "clipboard.png") # Compose command & run - cmd = Cmd(["osascript", "-e", "write (the clipboard as «class PNGf») to (open for access \"$(path_png)\" with write permission)"]) + cmd = Cmd(["osascript", "-e", "try\nwrite (the clipboard as «class PNGf») to (open for access \"$(path_png)\" with write permission)\nend try"]) run(cmd) # Paste from clipboard From cbc02f07e6b50410ea9e9603273f1029456dc111 Mon Sep 17 00:00:00 2001 From: hyrodium Date: Tue, 15 Jun 2021 22:35:19 +0900 Subject: [PATCH 2/4] update error handling for unsupported os --- src/ImageClipboard.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ImageClipboard.jl b/src/ImageClipboard.jl index 46c62ea..33773d5 100644 --- a/src/ImageClipboard.jl +++ b/src/ImageClipboard.jl @@ -38,7 +38,7 @@ function clipboard_img() elseif Sys.isapple() img = _osascript() else - error("Currently, only linux and windows are supported") + error("Only Linux, Windows, and Mac are supported") end return img end @@ -68,7 +68,7 @@ function clipboard_img(img::Matrix{<:Colorant}) elseif Sys.isapple() _osascript(img) else - error("Currently, only linux and windows are supported") + error("Only Linux, Windows, and Mac are supported") end return nothing end From 731d5714a0c8ff6df30f7245348850391da8c19b Mon Sep 17 00:00:00 2001 From: hyrodium Date: Tue, 15 Jun 2021 22:36:11 +0900 Subject: [PATCH 3/4] bump version to v0.1.0 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 445ac2f..79f3590 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ImageClipboard" uuid = "6db54171-f50f-4661-a74f-bc514ef16cee" authors = ["hyrodium and contributors"] -version = "0.0.2" +version = "0.1.0" [deps] ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" From c3258cf94de93974d635b7553d168db652473312 Mon Sep 17 00:00:00 2001 From: hyrodium Date: Tue, 15 Jun 2021 22:39:11 +0900 Subject: [PATCH 4/4] update docstrings --- src/_osascript.jl | 4 ++-- src/_powershell.jl | 4 ++-- src/_wlclipboard.jl | 4 ++-- src/_xclip.jl | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/_osascript.jl b/src/_osascript.jl index 489a9fe..6e68a6f 100644 --- a/src/_osascript.jl +++ b/src/_osascript.jl @@ -1,7 +1,7 @@ """ _osascript() -> Matrix{<:Colorant} -Paste an image from clipboard using osascript +Paste an image from clipboard using `osascript` """ function _osascript() mktempdir() do dir @@ -25,7 +25,7 @@ end """ _osascript(img::Matrix{<:Colorant}) -Copy an image to clipboard using osascript +Copy an image to clipboard using `osascript` """ function _osascript(img::Matrix{<:Colorant}) mktempdir() do dir diff --git a/src/_powershell.jl b/src/_powershell.jl index b1c7cc3..8b3e4d1 100644 --- a/src/_powershell.jl +++ b/src/_powershell.jl @@ -1,7 +1,7 @@ """ _powershell() -> Matrix{<:Colorant} -Paste an image from clipboard using powershell +Paste an image from clipboard using `powershell` """ function _powershell() mktempdir() do dir @@ -28,7 +28,7 @@ end """ _powershell(img::Matrix{<:Colorant}) -Copy an image to clipboard using powershell +Copy an image to clipboard using `powershell` """ function _powershell(img::Matrix{<:Colorant}) mktempdir() do dir diff --git a/src/_wlclipboard.jl b/src/_wlclipboard.jl index 7d934e0..1e2492f 100644 --- a/src/_wlclipboard.jl +++ b/src/_wlclipboard.jl @@ -5,7 +5,7 @@ end """ _wlclipboard() -> Matrix{<:Colorant} -Paste an image from clipboard using wl-paste +Paste an image from clipboard using `wl-paste` """ function _wlclipboard() img_buf = IOBuffer() @@ -23,7 +23,7 @@ end """ _wlclipboard(img::Matrix{<:Colorant}) -Copy an image to clipboard using wl-copy +Copy an image to clipboard using `wl-copy` """ function _wlclipboard(img::Matrix{<:Colorant}) img_buf = IOBuffer() diff --git a/src/_xclip.jl b/src/_xclip.jl index 6e67f0f..320996f 100644 --- a/src/_xclip.jl +++ b/src/_xclip.jl @@ -5,7 +5,7 @@ end """ _xclip() -> Matrix{<:Colorant} -Paste an image from clipboard using xclip +Paste an image from clipboard using `xclip` """ function _xclip() img_buf = IOBuffer() @@ -23,7 +23,7 @@ end """ _xclip(img::Matrix{<:Colorant}) -Copy an image to clipboard using xclip +Copy an image to clipboard using `xclip` """ function _xclip(img::Matrix{<:Colorant}) img_buf = IOBuffer()