marcusbuffett / pipe-rename

Rename your files using your favorite text editor
https://crates.io/crates/pipe-rename
MIT License
397 stars 12 forks source link

Can't use command line arguments in EDITOR #38

Closed jminer closed 2 years ago

jminer commented 3 years ago

I use Visual Studio Code, and I have to pass the --wait option to use it with pipe-rename. However, if I try doing that, I get an error:

PS C:\Files> $env:EDITOR="code.exe --wait"
PS C:\Files> renamer *.txt
Error: Failed to execute editor process

Caused by:
    The system cannot find the file specified. (os error 2)

I found that, as a workaround, I can create a batch file, say code-wait.bat, containing

code --wait %1

and then set EDITOR to it:

PS C:\Files> $env:EDITOR="code-wait.bat"

And then it works, but I'd rather not have to use the batch file. I may try to fix this someday if no one else does.

I'm using Windows 10 and pipe-rename 1.3.0 (updated today from crates.io).

BTW, I love the idea of pipe-rename! Thanks for writing and releasing it!

marcusbuffett commented 3 years ago

This is a really interesting case, I don't see why we couldn't call the $EDITOR as a command and not as a file, I'd welcome a PR for this, otherwise I'll try to get to it.

Glad you like the idea!