Textualize / trogon

Easily turn your Click CLI into a powerful terminal application
MIT License
2.4k stars 54 forks source link

Completions when editing values based on Shell Completions #41

Open benwart-consensus opened 1 year ago

benwart-consensus commented 1 year ago

Click Options have a shell_complete kwarg that takes a function that returns a list of completions. It would be helpful if trogon supported running this function by passing in the context and param based similar to how click does so that a dropdown of completions could be shown to pick from.

See Also: Click documentation on how Shell Completions are implemented

fresh2dev commented 1 year ago

I could see this being handled via the existing choices logic within Trogon. But that would make click choices and shell_complete mutually-exclusive in the context of Trogon; i.e., what would Trogon display in the drop-down if both choices and shell_complete were provided?

darrenburns commented 1 year ago

This is a nice idea - we have the Suggester feature in Textual now too which shows the greyed-out completion text that could be leveraged while implementing this.