On 14.01.2005, at 17:51, Chris Thomas wrote:
We need a command that will block waiting for the editor window to be closed. For BBEdit, that's the critical function that the 'bbedit' command line tool provides. I would assume that the 'see' tool can do it as well.
The reason is that many command-line tools invoke an external $EDITOR. CVS, Subversion, and especially Perforce's bloody 'forms' are good examples of this.
IMHO, the right way to do this would be to have a command line tool that uses the ODB interface (which is what FTP clients use to edit remote files) to tell TM to edit the file and notify the tool when the file is saved or closed (so that the tool can then exit).
One problem with this approach is that ODB works with Apple Events, and AFAIK, for TM to notify the tool, the tool must be an application, and must have a unique creator code.
I have some unreleased code that does work around this issue by launching a faceless background helper application, and then making a blocking call to the helper app (via DO) which in turn tells TM to edit the file and notify the helper app when done.
BTW, the helper app can already retreive remote files via SCP (if you have passwordless authentication set up) and upload them when the file is saved by TM.
And while I'm at it, I also have a command line wrapper around SSH that lets you initiate the editing session from the remote shell. That means you can ssh to the remote server, do whatever you have to do there, and when you need to edit a file, run a command that downloads said file to your local Mac, tells your favorite GUI editor (aka TM) to open the file, and re-uploads the file when you save it. (And yes, this is a definitive hack.)
I really think that all of this is pretty cool and would like to release it as open source, but unfortunately I'm currently lacking the time to polish it for release (it works for me already, you know :-)
So, I'm not sure where to go with this. Are people on this list interested in the whole thing, or just in the blocking editor command? I'd really appreciate some feedback.
Thanks, -Ralph.