CGenie / alfred-pass

Alfred 2 workflow for pass
GNU General Public License v3.0
88 stars 33 forks source link

Add feature to copy the username #16

Open ckotte opened 6 years ago

ckotte commented 6 years ago

Sometimes it's needed to copy the username before the password.

If you press and hold the alt key, the username is copied instead of the password.

CGenie commented 6 years ago

Hello, thank you for that contribution, it's very useful! However, it requires special format of the pass file, I guess I'd add that info to the README as well. Moreover, I think that in case login: is missing in the pass file, you could copy the last part of the pass path, i.e. suppose you have github pass stored in

store/github.com/ckotte

Then, if login: is not in that pass file, I'd copy ckotte. What do you think?

ckotte commented 6 years ago

Hi,

Sometimes I need to copy the login and password or just the password into the terminal or in a remote SSH/RDP session. Most of the time, I needed to open QtPass all the time to verify the account I need to use. Then I copied the password via alfred-pass. That's why I thought it would be nice to be able to copy the username via alfred-pass as well.

I also use browserpass on macOS and Linux which requires login: or user: in every pass file to work. On Linux there's also rofi-pass which can only use user: per default.

With browserpass, the structure also needs to include the URL to find the matching credentials automatically. E.g. store/github.com, or store/github.com/ckotte and store/github.com/test if you need two separate accounts.

Currently, login-show.sh will copy an empty string to the clipboard if login: or user: can't be found. I should add a check that oascript will be triggered only if the string isn't empty.

I assume you don't have user: or login: in your pass files and you don't use any of the tools I mentioned, right?

I can add the pass file format to the README. I can also add the code to copy the last part of the query if login: or user: can't be found. It would just copy the URL or the name if the format is store/github.com or store/GitHub.

CGenie commented 6 years ago

Yes, or just add the command description with pass file format to the README, that is fine as well I guess. Or preferably also copy the path to the pass file, just leaving out that initial store I think, pass requires it but no login uses it I think.

ckotte commented 6 years ago

The query contains only github.com/ckotte if the path is .password-store/github.com/ckotte. You just need to extract the text after the last \ if there's no login: or user:.

Could you explain? I don't understand what you mean.

preferably also copy the path to the pass file

rbuzatu90 commented 6 years ago

This looks usefull. Any Updates ? :)

ckotte commented 6 years ago

This looks usefull. Any Updates ? :)

I didn't got any answer to my question

CGenie commented 5 years ago

Sorry for not being active in this project for long...

The query contains only github.com/ckotte if the path is .password-store/github.com/ckotte. You just need to extract the text after the last \ if there's no login: or user:.

Could you explain? I don't understand what you mean.

preferably also copy the path to the pass file

Yes, the format I use for pass is simple: store/<hostname>/<username> so for me it would be best to first check if login: or user: is in the pass file and if not, just use the last path part of the pass file. About that comment of copying the path to the pass file: I guess I overengineered this, last path part would be enough imho :)

CGenie commented 5 years ago

Ah one more thing, you add the login-show.sh script which is based on pass-show.sh. That file was greatly improved in https://github.com/CGenie/alfred-pass/issues/14, you should take a look :)