You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
489 B
24 lines
489 B
8 years ago
|
#!/bin/bash
|
||
|
# Save whole files in CopyQ.
|
||
|
# USAGE:
|
||
|
# utils/copy_files.sh [FILES...]
|
||
|
# EXAMPLE:
|
||
|
# TAB=images utils/copy_files.sh ~/Pictures/*.jpg
|
||
|
COPYQ=${COPYQ:-copyq}
|
||
|
TAB=${TAB:-files}
|
||
|
|
||
|
set -e
|
||
|
|
||
|
i=0
|
||
|
for x in "$@"; do
|
||
|
# get MIME
|
||
|
mime=$(file -b -L --mime-type "$x")
|
||
|
# print info
|
||
|
printf "%s: %s\n" "$mime" "$x"
|
||
|
# write image with label
|
||
|
"$COPYQ" -s "$SESSION" tab "$TAB" write $((++i)) \
|
||
|
"application/x-copyq-item-notes" "$x" \
|
||
|
"$mime" - < "$x"
|
||
|
done
|
||
|
|