[TxMt] Help finishing Bundle command
Ken Scott
optikos at gmail.com
Mon Apr 3 02:01:24 UTC 2006
Thank you Allan, I appreciate the help. It appears to work perfectly.
I would like to submit the following command to the Subversion bundle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Delete from Repository.plist
Type: application/octet-stream
Size: 1518 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20060402/f90ae6e3/attachment.plist>
-------------- next part --------------
Thanks,
Ken Scott
On Apr 2, 2006, at 5:53 PM, Allan Odgaard wrote:
> On 3/4/2006, at 1:24, Ken Scott wrote:
>
>> if [ "$rv" == "Delete" ]; then
>> eval "$TM_SVN" del "${TM_SELECTED_FILES:-$TM_FILEPATH}"
>
> You should split the last line up into:
>
> if [[ -n "$TM_SELECTED_FILES" ]];
> then eval "$TM_SVN" del "$TM_SELECTED_FILES"
> else "$TM_SVN" del "$TM_FILEPATH"
> fi
>
> Because only with TM_SELECTED_FILES do we want to re-evaluate the
> line, after initial variable expansion.
>
>> elif [ "$rv" == "No" ]; then
>> exit
>> elif [ "$rv" == "Cancel" ]; then
>> exit
>> fi
>
> You can do:
>
> elif [[ "$rv" == "No" || "$rv" == "Cancel" ]]; then
> exit
> fi
>
>> What I want is the list of files in the CocoaDialog textbox to be
>> newline-separated, and have the enclosing quotes removed (ideally,
>> the project base path as well). I don't have any bash-fu to figure
>> this out.
>
> Here you go. First it converts the variable to a bash array, then
> it iterates over the array, writes the filename with a potential
> $TM_PROJECT_DIRECTORY/ prefix removed.
>
> The CocoaDialog code calls this function and sorts the result (to
> get a sorted file listing).
>
> file_list () {
> if [[ -n "$TM_SELECTED_FILES" ]]; then
> eval arr=("$TM_SELECTED_FILES")
> for (( i = 0; i < ${#arr[@]}; i++ )); do
> FILE="${arr[$i]}"
> echo "${FILE##$TM_PROJECT_DIRECTORY/}"
> done
> else
> echo "$TM_FILENAME"
> fi
> }
>
> rv=`CocoaDialog textbox --title "Delete from Repository" \
> --string-output --no-newline --informative-text \
> "These files will be scheduled for deletion during the next
> commit." \
> --text "$(file_list|sort -f)" --button1 "Delete" --button2
> "Cancel"`
>
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>
More information about the textmate
mailing list