c3c icon indicating copy to clipboard operation
c3c copied to clipboard

Proposal: watch mode

Open rtc11 opened this issue 1 year ago • 2 comments

A very common workflow in modern software development is to use a "watch-mode" to trigger automatic rebuild/test/compile/run every time a watched file is changed.

There are some considerations:

  1. should the watch-mode work with projects only. This way it is possible to look up for new and deleted files.
  2. should it work for compile-* commands also? This would be more primitive only looking for specified files in the command.

To be cross-platform, this requires interaction with the file-systems-metadata on every platform. The hard part is to test this, as it might need manual testing on different architectures.

GHA supports some major platforms, I also found this Github Action for BSD that utilies qemu: https://github.com/cross-platform-actions/action

Another solution is to use a third-party library as a temporary solution, e.g. https://github.com/SpartanJ/efsw

rtc11 avatar Dec 16 '24 09:12 rtc11

I think the watch flag would be an overkill for a statically typed programming language, because it has to go through multiple phases during compilation and run procedure.

Personally I have mapped a hotkey in Vim editor to run c3c run -q which compiles and runs almost instantly, which is not exactly what you are looking for, but it works just as fine as a watch flag.

stefanos82 avatar Dec 16 '24 10:12 stefanos82

After thinking about this a bit: yes, it should be added. I am not sure about the timeframe though, so I've tentatively put it for 0.8.0, but if someone tackles it early or I have a lot of time on my hands it will happen early.

lerno avatar May 15 '25 07:05 lerno