Passing in filepath parameters more easily
I think Pet is pretty useful, and love how easy it is to search, share and sync commands via a gist!
All of the commands that I currently use Pet for actually take a filepath as a parameter! This is quite difficult to do at the moment because you cannot auto-complete file paths as you normally can on the shell. This means I often have to copy and paste the filepath - opening a new shell to do this - which is relatively laborious and time-consuming.
I'm not sure how easy it would be to implement auto-complete when entering filenames, but I have an alternative suggestion where pet prints the stored command (leaving in the parameter placeholders), allowing you to copy this into the command-line and edit it to your heart's content. Pet will not execute the command.
This could be used by pet print, pet search --print, or maybe pet exec --print.
I'm not aware of any improvement in the meantime, but here is a less laborious way to achieve what you are looking for:
- Run
pet search | xclip - Fill every parameter you can without auto-completion
- After
<RET>, the half-filled command is in your clipboard - Paste it on the terminal and enjoy your shell's auto-completion
To not lost file path placeholders, you might prefer <input=in.pdf> over <inputPDF>.
Very fair ask, this is a nice workaround I've seen in quite a few tickets, I think we should consider building it into pet as you suggest.
As a vision for pet, I do want to see it supporting shell autocomplete in the future but I'm not sure if that's even possible. I'm not a shell expert yet! Will look into it at some point but for now I'm going to look into your suggestion.
This does seem pretty simple to implement, will give it a go this week!
https://pkg.go.dev/github.com/atotto/clipboard
@firmart @QasimK Pet actually supports adding to clipboard with the clip command, check that out.
As for autocompletion, that's also possible. We'll work on ZSH/bash autocompletion plugins soon enough! Thanks for suggesting this 😄
Glad to see the improvement over the years ! Thanks for your contribution @RamiAwar !