spezifisch / stmps

Subsonic Terminal Music Player S
GNU General Public License v3.0
20 stars 6 forks source link

Implement more flexible commands framework #31

Open spezifisch opened 3 months ago

spezifisch commented 3 months ago

To better support adding new features in future, especially to make integrating PRs easier, there should be a centralized way of handling commands.

This will also make it easier for users to rebind keys to their liking or to implement more complex sequences of commands. My idea is that commands like addRandomSongs 50 can be bound to a key in a certain context, e.g. only valid inside the queue page. These commands can also be run manually using a shell-like command syntax, further info in the repo below (this is WIP).

Since something like that doesn't seem to exist for our UI framework tview yet I created the tview-command repo to develop something stmps can use. I really hope to keep the scope of this little side-project constrained but I believe now is the best time work on this before we implement further commands.

xxxserxxx commented 1 month ago

@spezifisch Can I help with this? What's the status of the tview-command? If I can help with merging, let me know.

spezifisch commented 1 month ago

@spezifisch Can I help with this? What's the status of the tview-command? If I can help with merging, let me know.

I'm working on a "test rig" to validate that every kind of supported key binding works: https://github.com/spezifisch/tview-command/blob/6352bfb05f0907188a3268daab6eee5289ffd452/DEVELOPERS.md

Current status is that config parsing and validation is fully implemented, which is basically a hierarchical graph of keybindings. But as of now, on the "keybinding lookup side" (if that makes sense), only simple bindings without inheritance work. There is probably just some inconsistency somewhere. This problem should flush out with some more unit tests.

Also t-c now has a TODO: https://github.com/spezifisch/tview-command/blob/main/TODO.md

xxxserxxx commented 1 month ago

Ok. If you think of a way I can help, let me know. Maybe when it's ready, we can divide and conquer the page_* types.