trogon icon indicating copy to clipboard operation
trogon copied to clipboard

Add ability to copy the running command

Open derlin opened this issue 2 years ago • 2 comments

As stated in the readme, trogon is made for discoverability, but after trying out the command, we want to actually add it to our history and use it directly. This feature request is thus about adding a shortcut to copy the command to the clipboard.

derlin avatar May 22 '23 13:05 derlin

I wonder if it would be possible to add it to the bash history?

I ran sqlite-utils tui and then built a complex command, but when I hit Up on my keyboard it gave me the sqlite-utils tui command again when I wanted to see the command it had built for me.

simonw avatar May 25 '23 19:05 simonw

I looked into Python-driven additions to shell history for a Typer-based CLI I've built (which uses Trogon for command discoverability) and ultimately found that there doesn't appear to be a POSIX-like standard way of adding commands to shell history across all the different shell types, which I imagine to be the reason this doesn't already have a tidy solution readily available. To highlight just a few:

  • Bash uses history -s
  • Zsh uses print -s
  • Fish doesn't offer any solid way of doing this

daneah avatar Sep 20 '24 13:09 daneah