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

monitor: add common shell features to dev prompt #1289

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tonistiigi
Copy link
Member

This makes the monitor mode from —invoke more
user friendly by enabling features user might expect
from dev shell.

Interactive mode now has colors, history and keyboard
control for movement (arrows, moving to beginning/end,
by word, emacs controls etc).

Opening as draft. If this solution (and base library it uses) seems desirable then some updates are needed in go-prompt (or fork) to make it more configurable (currently made changes in vendor).

@ktock

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This makes the monitor mode from —invoke more
user friendly by enabling features user might expect
from dev shell.

Interactive mode now has colors, history and keyboard
control for movement (arrows, moving to beginning/end,
by word, emacs controls etc).

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@ktock
Copy link
Collaborator

ktock commented Aug 22, 2022

SGTM, thank you!

Copy link
Collaborator

@jedevc jedevc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be super useful 🎉 The approach LGTM 😄

I like the splash of color in it - ideally we'd sync up with the buildkit colors in some way. Autocompletion would also be excellent to add at some point once we've stabilized what all the monitor mode commands would be.

monitor/monitor.go Show resolved Hide resolved
}

prompt.New(exec, completer, prompt.OptionHistory([]string{
"reload", "rollback", "exit", "help",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sets the history at the beginning? I think we probably should just leave this empty (maybe a future enhancement to save the history to ~/.buildx/monitor_history or similar?)

@jedevc
Copy link
Collaborator

jedevc commented Apr 11, 2023

@tonistiigi what changes would be needed in go-prompt? Would it be feasible to try and take this for v0.11?

@tonistiigi
Copy link
Member Author

see the changes in vendor 6e05092

@jedevc
Copy link
Collaborator

jedevc commented Apr 12, 2023

Looking through go-prompt, the maintainer seems inactive, so it seems likely we'd probably have to fork if we need changes.

@crazy-max
Copy link
Member

Looking through go-prompt, the maintainer seems inactive, so it seems likely we'd probably have to fork if we need changes.

https://github.com/erikgeiser/promptkit and https://github.com/charmbracelet/bubbletea looks to be reliable alternatives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants