short shortcuts or cclip
This commit is contained in:
21
files/cclip
21
files/cclip
@@ -21,7 +21,8 @@ Paste files using clipboard:
|
|||||||
-s Use soft link instead of file copying
|
-s Use soft link instead of file copying
|
||||||
-l Use hardlink instead of file copying
|
-l Use hardlink instead of file copying
|
||||||
-k Keep clipboard link
|
-k Keep clipboard link
|
||||||
-m Move instead of copy (can not be used with -h, can not -k)
|
-m Move instead of copy (can not be used with any other switch)
|
||||||
|
Shortcut to switches example: ${HL}$SELF plk${NO} equals -l and -k
|
||||||
|
|
||||||
Delete source files using clipboard links (WARNING):
|
Delete source files using clipboard links (WARNING):
|
||||||
${HL}$SELF rm/remove clipboardname[s]${NO}
|
${HL}$SELF rm/remove clipboardname[s]${NO}
|
||||||
@@ -115,7 +116,6 @@ _simple_list() {
|
|||||||
ls -1 "$STORAGE"
|
ls -1 "$STORAGE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_copy() {
|
_copy() {
|
||||||
numargs=$#
|
numargs=$#
|
||||||
if [[ $# -lt 2 ]]; then
|
if [[ $# -lt 2 ]]; then
|
||||||
@@ -166,6 +166,12 @@ _edit() {
|
|||||||
_paste() {
|
_paste() {
|
||||||
numargs=$#
|
numargs=$#
|
||||||
keeplink=0
|
keeplink=0
|
||||||
|
# ps pl pk style command
|
||||||
|
if [[ "$1" =~ s ]]; then softlink=1; fi
|
||||||
|
if [[ "$1" =~ l ]]; then hardlink=1; fi
|
||||||
|
if [[ "$1" =~ k ]]; then keeplink=1; fi
|
||||||
|
if [[ "$1" =~ m ]]; then movelink=1; fi
|
||||||
|
# parse switches
|
||||||
for (( i=2; i<=$#; i++ )); do
|
for (( i=2; i<=$#; i++ )); do
|
||||||
case ${!i} in
|
case ${!i} in
|
||||||
-s) softlink=1; ;;
|
-s) softlink=1; ;;
|
||||||
@@ -259,17 +265,16 @@ _paste_single() {
|
|||||||
|
|
||||||
# -L dereference symlinks, -P no-deref (keep as symlink)
|
# -L dereference symlinks, -P no-deref (keep as symlink)
|
||||||
# -H follow symlinks
|
# -H follow symlinks
|
||||||
|
if [[ "$softlink$hardlink$movelink" =~ 11 ]]; then
|
||||||
|
_err "Can not do both soft and hard link, or mix with move link"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if [[ "$movelink" -eq 1 ]]; then
|
if [[ "$movelink" -eq 1 ]]; then
|
||||||
echo Moving "${1} -> $target"
|
echo Moving "${1} -> $target"
|
||||||
mv "$1" "$target"
|
mv "$1" "$target"
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$softlink$hardlink" = "11" ]]; then
|
|
||||||
_err "Can not do both soft and hard link"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$softlink" = 1 ]]; then
|
if [[ "$softlink" = 1 ]]; then
|
||||||
echo Symbolic link "${1} -> ${OUTPUT}/$target"
|
echo Symbolic link "${1} -> ${OUTPUT}/$target"
|
||||||
ln -s "${1}" "${OUTPUT}/$target"
|
ln -s "${1}" "${OUTPUT}/$target"
|
||||||
@@ -539,7 +544,7 @@ OUTPUT=.
|
|||||||
[[ "$CMD" = "d" || "$CMD" = "delete" || "$CMD" = "del" ]] && { _delete "$@"; }
|
[[ "$CMD" = "d" || "$CMD" = "delete" || "$CMD" = "del" ]] && { _delete "$@"; }
|
||||||
[[ "$CMD" = "D" || "$CMD" = "Delete" || "$CMD" = "Del" ]] && { _delete_all; }
|
[[ "$CMD" = "D" || "$CMD" = "Delete" || "$CMD" = "Del" ]] && { _delete_all; }
|
||||||
[[ "$CMD" = "e" || "$CMD" = "edit" ]] && { _edit "$@"; }
|
[[ "$CMD" = "e" || "$CMD" = "edit" ]] && { _edit "$@"; }
|
||||||
[[ "$CMD" = "p" || "$CMD" = "paste" ]] && { _paste "$@"; }
|
[[ "$CMD" = "p" || "$CMD" = "paste" || "$CMD" =~ ^p.$|^p..$ ]] && { _paste "$@"; }
|
||||||
[[ "$CMD" = "rm" || "$CMD" = "remove" ]] && { _remove "$@"; }
|
[[ "$CMD" = "rm" || "$CMD" = "remove" ]] && { _remove "$@"; }
|
||||||
[[ "$CMD" = "mc" ]] && { _gui "$@"; }
|
[[ "$CMD" = "mc" ]] && { _gui "$@"; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user