bacon icon indicating copy to clipboard operation
bacon copied to clipboard

Feature request: watching updates docs

Open Cthutu opened this issue 2 years ago • 3 comments

Great tool btw.

But I was using the doc-open command (by pressing D) to build and open the documents (presumably using cargo doc --open) and noticed that when source files are changed the docs are not rebuilt.

This feature to trigger a rebuild and to refresh the browser window (if possible) would be really useful when dealing with documentation comments. For example, you can hit D on bacon, add comments throughout your source code, and refresh or view in the browser the changes immediately.

Cthutu avatar Apr 10 '23 10:04 Cthutu

Here's the current set of doc related jobs:

[jobs.doc]
command = ["cargo", "doc", "--color", "always", "--no-deps"]
need_stdout = false

# if the doc compiles, then it opens in your browser and bacon switches
# to the previous job
[jobs.doc-open]
command = ["cargo", "doc", "--color", "always", "--no-deps", "--open"]
need_stdout = false
on_success = "back" # so that we don't open the browser at each change

The last line prevents bacon from opening a new browser window or tab at each change.

I just had an idea, changing this last line to

on_success = "job:doc"

This way the doc is updated (you still have to refresh in the browser).

There's a problem which prevents me from making that the new standard: hitting back would go back to the doc-open job instead of the previous one. I could fix that with a new action for the doc job. I'll have to think. Opinion welcome.

Canop avatar Apr 19 '23 18:04 Canop