yopass icon indicating copy to clipboard operation
yopass copied to clipboard

[Feature] CLI: Default behaviour encrypt from editor

Open avesst opened this issue 5 months ago • 2 comments

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...

  1. Open a file, enter information, save it, cat and pipe to yopass
  2. 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.

Screencast from 2024-10-01 18-51-08.webm

avesst avatar Oct 01 '24 17:10 avesst