yopass
yopass copied to clipboard
[Feature] CLI: Default behaviour encrypt from editor
I use Yopass quite a lot in my work, and usually I have a secret in the clipboard I need to send with some additional information. Instead of having either...
- Open a file, enter information, save it,
cat
and pipe toyopass
- Open the browser, enter information, encrypt
I thought of what if the default behaviour if the CLI was ran without --file
or something piped to it, that it opened a temporary file in an editor, and when you saved and closed the editor the contents would be sent to Yopass and an URL returned.
I've managed to create a prototype of this (branch), which I think works quite well. For the time being, it reads the $EDITOR
environment variable and opens that editor, with fallback to vi
.
I'm not sure if that generic environment variable is the way to go, or perhaps one specific to Yopass should be used.
I briefly tried making this work with Notepad as default in Windows, but I couldn't get Notepad to re-save the temporary file to C:\Users\user\AppData\Local\Temp
- it kept forcing a "Save As" dialog on me and I have not made any further attempts.
Before spending any more time on this I wanted to gather people's thoughts on this. Attached a small video as demonstration.