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

In-tool command history support #66

Open
shtrom opened this issue Oct 26, 2023 · 1 comment
Open

In-tool command history support #66

shtrom opened this issue Oct 26, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@shtrom
Copy link

shtrom commented Oct 26, 2023

This module is insanely useful in the case of complex command lines.

One aspect that I think would make it even better is some sort of history support. Not shell history like #12, but actual built-in history within TUI where you can recall commands built in previous runs of the TUI, and either re-edit them or re-run them verbatim.

If editing a command, it would be good to also be able to have the option to either overwrite the previous history entry, or create a new one.

This would offer the ability of recalling oft-used recipes or templates without having to rebuild them from scratch each item. One could even foresee named templates in addition to just historical entries.

@daneah daneah added the enhancement New feature or request label Sep 20, 2024
@daneah daneah changed the title [enhancement] History support In-tool command history support Oct 2, 2024
@daneah
Copy link
Collaborator

daneah commented Oct 25, 2024

I will share a way that we ended up doing this outside the confines of Trogon, for what it's worth, perhaps to inspire further ideas:

Our organization has a data warehouse where we log user events. I hooked the Typer application I built into that system so that it logs each command users run, including the full command string. This is helpful to me to understand usage and audience and so on.

I ended up adding a history command to my Typer application—because the application knows the current user, and because it knows how to query the data warehouse, it's able to present the most recent commands a user has run.

I could see abstracting this all to some kind of pluggable persistence layer for command history. That way it could be a file on the file system, or a data warehouse query, or any arbitrary API call. Finding some way to thread this through from the Click app to Trogon would be a trick, of course, and would require some amount of "by convention"...not sure I like all that but just off the top of my head, here!

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