coteditor / cot

Command-line helper tool for CotEditor
https://coteditor.com/cot
Apache License 2.0
55 stars 11 forks source link

Multi File Find and terminal scripts #17

Closed Fred-IV closed 1 month ago

Fred-IV commented 1 month ago

Current issue

I am looking at CotEditor, because I want to replace BBEdit.

There's no multi file find, so I thought I would try to make one. I am no unix guru, but I think I got this right, and it doesn't work.

If you're not going to add the ability to do a multi file find, then we could use scripts, but I can't get this to work. I tried; grep -lir "hyper" ~/Desktop/test | while read line ; do cot "$line" ; done and it only opens the first file found.

If I use other commands, like "more" or "echo", instead of "cot", it does find all 4 files. I tried a sleep for 2 seconds between opens, and it won't work. (the sleep works, and there's a pause, but still only the 1st file opens in cot.) If I go into terminal with a file already open in cot, I can open another, so for some reason, the multi file open is just failing.

The solution you'd like

As a feature request, we need multi file functions, like find, and eventually find/replace. But until then, maybe someone knows why this terminal script fails?

If it is fixable, maybe we could use add-on scripts for the missing features we need.

Alternatives you've considered

I've looked at other editors to replace BBEdit, but most are too large and clunky, or the interface is not as clean. I like CotEditor, and would love to see it evolve.

Until then, if I can get a few scripts working for the missing features, I could make it work.

CotEditor version

4.8.7

macOS version

14.5

Additional context

Mac Pro Mid 2010 Processor 2 x 3.46 GHz 6-Core Intel Xeon Graphics AMD Radeon RX 580 8 GB Memory 128 GB 1333 MHz DDR3 Startup disk NVME macOS Sonoma 14.5

Fred-IV commented 1 month ago

Well, it seems to be a bug in CotEditor. I tried TextMate next, and this terminal command worked just fine. Opened all 4 files.

grep -lir "hyper" ~/Desktop/test | while read line ; do mate "$line" ; done

Although, it may not be necessary, as I think TextMate will already do multi file searches. I am looking at that one next to replace BBEdit.

mugsuk commented 1 month ago

I love Coteditor but am using Smultron for the single reason you have mentioned - I need to be able to search in a folder with multiple files. Smultron is an excellent editor and very similar to CotEditor

1024jp commented 1 month ago

Thank you for the report.

I found the current implementation of cot reads all piped text when it is invoked. This would be the reason of your issue. I've changed it not to read piped text if a file is specified as the option. The change will be applied to the next major update of CotEditor, which will be released this autumn.