aurora / rmate

Remote TextMate 2 implemented as shell script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

remote directory edit support

alan-w-255 opened this issue · comments

commented

it will be awesome if it supports remote directory editing

I decided to work on a patch for this, see also: #44 (comment). A question regarding this, also to @KES777: should this work in a recursive way, so if there are subdirectories in the folder, should the files of the subdirectories be opened as well?

I think we can control subdirectories with some sort of option: -r. like rm -r etc commands have

I've created a branch for this feature: https://github.com/aurora/rmate/tree/issue-64, please have a look, but keep in mind, that i didn't test it thoroughly, backup your files before testing!

By default recursion is deactivated, but you can enable it by specifying the -r argument (eg.: rmate -r folder. I've also added a hard-limit which applies to all files (directly specified on commandline as well as files found in (sub)directories), which is currently set to 20. That means: rmate will not open more than 20 files. I've added this limit to prevent issues when you by accident specify a directory with thousands of files (eg.: directories with .git folder inside).

What do you think?

Thinking about all the trouble this feature could cause i feel again very unhappy about it and in my opinion it's not really the UNIX way to do things. You would have so many more possibilities by just combining rmate with for example find, eg.:

Open all php files in a directory (recursive):

find folder -name "*.php" -print0 | xargs -0 rmate

Open all php files in a directory (non-recursive):

find folder -maxdepth 1 -name "*.php" -print0 | xargs -0 rmate

etc.

You would have so many more control over what you really would like to open by combining standard UNIX tools and rmate. Maybe it's just a documentation issue ...

directories with .git folder inside

the .git directory maybe added to exclude list by default. (maybe it will be better to exclude any hidden file .*)

Maybe it's just a documentation issue

Maybe just shortcuts. For example:

rmate folder/*.php

will translate into:

find folder -maxdepth 1 -name "*.php" -print0 | xargs -0 rmate

The latter is already possible, it's called parameter expansion (globbing) and done by the shell automatically, so executing rmate *.php already does what you would expect it to do. No need for any modifications to rmate. Mmmm ... i'll think about excluding predefined folders ...