rmate icon indicating copy to clipboard operation
rmate copied to clipboard

remote directory edit support

Open alan-w-255 opened this issue 7 years ago • 7 comments

it will be awesome if it supports remote directory editing

alan-w-255 avatar Nov 14 '17 11:11 alan-w-255

+1

Oxicode avatar Dec 05 '17 15:12 Oxicode

I decided to work on a patch for this, see also: https://github.com/aurora/rmate/pull/44#issuecomment-355735741. 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?

aurora avatar Jan 06 '18 10:01 aurora

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

KES777 avatar Jan 06 '18 11:01 KES777

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 ...

aurora avatar Jan 09 '18 10:01 aurora

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 .*)

KES777 avatar Jan 10 '18 08:01 KES777

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

KES777 avatar Jan 10 '18 08:01 KES777

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 ...

aurora avatar Jan 10 '18 09:01 aurora