Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortcuts to launch arbitrary commands #52

Closed
dbr opened this issue Aug 20, 2021 · 2 comments
Closed

Shortcuts to launch arbitrary commands #52

dbr opened this issue Aug 20, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@dbr
Copy link

dbr commented Aug 20, 2021

I've been using bacon for quite a while and it's very useful. The way I seem to use it most often is:

  1. Edit things
  2. Switch to terminal where bacon is running, check if any things need fixing
  3. [repeat]
  4. Once all is good, quit bacon, hit "up twice" to recall some kind of cargo run ... command and run that
  5. Once done, relaunch bacon (up+up+return) and repeat the whole process

For this, it would be nice if there was a way to configure a key I could press in bacon which would execute an arbitrary command. So instead I could:

  1. Edit
  2. Switch to bacon
  3. Press "r" - this would run, say, cargo run -- --customthing=1

Basically I can configure a keyboard key and the command it will invoke.

Such a feature would probably need some careful thought as to constrain the scope of what can and cannot be done (to avoid it being a few "what if it could also.." steps away from becoming a full terminal multiplexer!) - as such, at least for the above I imagine it would be limited as follows:

  1. When invoking the command, everything else is stopped - the main checking command is no longer run, no further shortcuts are accepted, etc (to prevent having to mix multiple outputs somehow)
  2. The output from the custom command is presented as-is in the scrollable output window - no parsing, just appending each line to output (if it could entirely stop the TUI interface, run the command in plain terminal, and restore, then even better)
  3. Once the command exits, there is maybe some "press enter to return" prompt (so the terminal output remains visible in event of crash)
  4. After that, the output is cleared and the normal checking is resumed

Aside from my use-case above, this might be a nice solution to #47 - you could bind, say, d to run cargo doc --open then when you run bacon doc you can press d at any time to (re)open the docs in browser

Hope that makes sense! Feel free to close this if it seems outside the scope of what you thing bacon should do!

@Canop
Copy link
Owner

Canop commented Aug 20, 2021

Hope that makes sense

It does. This was in my initial TODO list.

@Canop
Copy link
Owner

Canop commented Feb 8, 2022

The work has began. The shortcuts branch lets you define key shortcuts to internals (scrolling, quitting, etc.) and to jobs.

The new default bacon.toml file does include the d key to open the cargo doc.

I still need a few days before I have everything ready for release (I'll probably make a site to render everything clear, and an help page in the app to show all shortcuts).

@Canop Canop added the enhancement New feature or request label Feb 8, 2022
@Canop Canop self-assigned this Feb 8, 2022
@Canop Canop mentioned this issue Feb 13, 2022
@Canop Canop closed this as completed in ad1bf1b Feb 16, 2022
Canop added a commit that referenced this issue Feb 16, 2022
Fix #5
Fix #42
Fix #47
Fix #52
Fix #66
Fix #67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants