开发者

How do I add a file to a TextMate project from the command line?

I'd like to be able to add a file to a Textmate project (which is currently open) from the command line. Is there a way to do it (maybe via Applescript, the mate command, dire开发者_Go百科ctly editing the project file, etc.)?


Here is a sample TextMate project file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>documents</key>
    <array>
        <dict>
            <key>filename</key>
            <string>bar.c</string>
        </dict>
        <dict>
            <key>filename</key>
            <string>foo.c</string>
        </dict>
        <dict>
            <key>filename</key>
            <string>../src/c/linkedlist.c</string>
        </dict>
    </array>
    <key>fileHierarchyDrawerWidth</key>
    <integer>265</integer>
    <key>metaData</key>
    <dict/>
    <key>showFileHierarchyDrawer</key>
    <true/>
    <key>windowFrame</key>
    <string>{{282, 3}, {1148, 875}}</string>
</dict>
</plist>

All you need to do is create a command-line tool which adds the following information:

        <dict>
            <key>filename</key>
            <string>PATH_TO_FILENAME</string>
        </dict>

Don't forget to replace PATH_TO_FILENAME with real path. Normally, I would write the script to illustrate my point, but since I don't have time, I can only offer this suggestion instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜