Textmate命令:重复文件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Textmate命令:重复文件相关的知识,希望对你有一定的参考价值。
# so we can work with relative paths cd "$TM_DIRECTORY" # construct a default name for the duplicate def_name=`perl -pe <<<"$TM_FILENAME" 's/^(.*?)(.[^.]*)?$/$1 copy$2/'` # prompt user for a name CocoaDialog inputbox --text "$def_name" --button1 "Duplicate" --button2 "Cancel"|{ # if user selected 'Duplicate' and file doesn't exist read res; read new_name; if [[ "$res" == "1" && ! -e "$new_name" ]]; then # do the actual duplication cp -p "$TM_FILENAME" "$new_name" # force TM to refresh project drawer and open duplicate { osascript -e 'tell application "SystemEvents" to activate' -e 'tell application "TextMate" to activate' # open -a TextMate "$new_name"; } &>/dev/null & fi }
以上是关于Textmate命令:重复文件的主要内容,如果未能解决你的问题,请参考以下文章