Skip to content

allow replacing job (change job without affecting stack) - #472

Closed
ralrhona wants to merge 1 commit into
Canop:mainfrom
ralrhona:feat/replace-job-action
Closed

ralrhona wants to merge 1 commit into
Canop:mainfrom
ralrhona:feat/replace-job-action

Conversation

@ralrhona

@ralrhona ralrhona commented Oct 30, 2026 •

Copy link
Copy Markdown

One thing I always wished bacon would do is open the docs in my browser upon hitting [d], and then stay on the regular watched docs view until I changed mode again. (I even remember when it would rerun --open after every file watch event!)

And it looks like I'm not alone, even back in 2023 (#128).

My PR just adds a new action that replaces the current job, doing everything NextJob did minus pushing the last job to the job stack. I did it pretty quickly and naively, you may not want such a flag in your main app loop, but hopefully this can at least serve as some sort of inspiration?

Thanks for continuing to maintain this great tool.

@Canop

Canop commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Implementation isn't right, but the idea seems very good.

What we want is to go to a job and then, when there's a back, skip the starting job.

There are other ways to express this, but "replace the current job with this job in the stack", as you propose, looks good.

A semantic detail: replace-job:xxx makes it looks like the the current job replaces xxx while it's the opposite: xxx replaces the current job in the stack. Not sure what could be both clearer and not too hard to remember and type. Maybe become:xxx or continue-with-job:xxx ou replace-job-with:xxx.

@Canop

Canop commented Oct 30, 2026

Copy link
Copy Markdown
Owner

I'm taking it from there, starting from your PR, thanks.

@c-git

c-git commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Throwing in my two cents, I like replace-job-with:xxx

@ralrhona

ralrhona commented Oct 30, 2026 •

Copy link
Copy Markdown
Author

I don't have a huge preference for how it ends up being expressed, happy to simply serve as inspiration.

A semantic detail...

I had similar thoughts regarding the word order itself, specifically whether to do replace-job or job-replace, though it looks like the preference in this repo is verb-noun rather than noun-verb? Any of your suggestions should be fine, no strong preference from me.

Looking forward to see how you implement it!

@Canop

Canop commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Please test the modified implementation in #473

@ralrhona

ralrhona commented Nov 2, 2026

Copy link
Copy Markdown
Author

@Canop Seems to work a treat! I'll close this PR in favor of #473. In the off chance I run into a snag, I'll let you know.

@ralrhona ralrhona closed this Nov 2, 2026
Canop added a commit that referenced this pull request Nov 2, 2026
With the replace-job-with:doc action, it's now possible to have the doc-open job switch to the doc job, watching changes to update the doc without reopening a new browser window every time, but allowing going back to the previous job.

Thanks @ralrhona for the idea and proof of concept in PR #472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants