Skip to content

Commit

Permalink
Merge pull request #21 from hyrodium/fix/error_handling
Browse files Browse the repository at this point in the history
Fix error handling, bump verison to v0.1.0
  • Loading branch information
hyrodium committed Jun 15, 2021
2 parents cd607ba + c3258cf commit 5c9155e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ImageClipboard"
uuid = "6db54171-f50f-4661-a74f-bc514ef16cee"
authors = ["hyrodium <hyrodium@gmail.com> and contributors"]
version = "0.0.2"
version = "0.1.0"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand Down
4 changes: 2 additions & 2 deletions src/ImageClipboard.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/_osascript.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""
_osascript() -> Matrix{<:Colorant}
Paste an image from clipboard using osascript
Paste an image from clipboard using `osascript`
"""
function _osascript()
mktempdir() do dir
# Define path
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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/_powershell.jl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/_wlclipboard.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/_xclip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 5c9155e

Please sign in to comment.