nnn

mirror of https://github.com/jarun/nnn
Log | Files | Refs | README | LICENSE

cbpaste-mac (725B)


      1 #!/usr/bin/env sh
      2 # shellcheck disable=all
      3 
      4 # Description: Paste the clipboard files into the current directory.
      5 #              Only works if clipboard contents are files.
      6 #
      7 # Note: Supports only MacOS
      8 #
      9 # Shell: POSIX compliant
     10 # Author: Syed Umar Anis
     11 
     12 
     13 fs=($( osascript -e "use framework \"Foundation\"
     14     property this : a reference to the current application
     15     property NSPasteboard : a reference to NSPasteboard of this
     16     property NSURL : a reference to NSURL of this
     17     property pb : a reference to NSPasteboard's generalPasteboard
     18 
     19     property text item delimiters : linefeed
     20 
     21     pb's readObjectsForClasses:[NSURL] options:[]
     22     (result's valueForKey:\"path\") as list as text" ))
     23 
     24 cp -R -- "${fs[@]}" "$2/"