mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
pbfile function in macos.plugin.zsh
This commit is contained in:
parent
3e7ef0182f
commit
b7c2682ca0
1 changed files with 16 additions and 0 deletions
|
|
@ -314,3 +314,19 @@ source "${0:h:A}/music"
|
|||
|
||||
# Spotify control function
|
||||
source "${0:h:A}/spotify"
|
||||
|
||||
# Copy file to the macOS pasteboard
|
||||
function pbfile() {
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: pbfile <file>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -e "$1" ]]; then
|
||||
echo "File not found: $1"
|
||||
return 1
|
||||
fi
|
||||
|
||||
osascript -e "tell application \"Finder\" to set the clipboard to (POSIX file \"$(realpath "$1")\")"
|
||||
echo "Copied $1 to pasteboard"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue