gopass icon indicating copy to clipboard operation
gopass copied to clipboard

Can wildcards be used?

Open daiaji opened this issue 2 years ago • 7 comments

Like this. gopass rm 192.168.*

gopass rm 192.168.*   
Error: Can not delete key "192.168.2.0.gpg" from "192.168.1.4.gpg": entry is not in the password store

Actually since this is ZSH's wildcard at work. This command is equivalent to the following command. gopass rm 192.168.1.4 192.168.2.0 And it seems that most of the commands of gopass do not support manipulating multiple items at a time, the wildcards supported by ZSH are not actually available.

daiaji avatar Feb 01 '22 05:02 daiaji

As you stated wildcard-expansions are done at the shell, and I'm not confident that you get the expected results even if your $PWD is pointing to the store-path. As your snippet shows it also appends the '.gpg' suffix on expansion.

Even if that would be removed, in the current version 'rm' only retrieves the first argument. You can however delete directories recursively.

TM2500 avatar Feb 02 '22 00:02 TM2500

Wildcards are important, are there any plans to develop this feature? And I can't seem to use the commands I'm used to, such as rm -rf, which makes me very uncomfortable. The fuzzy matching of show is useful, can it be applied to the rm command?

daiaji avatar Feb 02 '22 04:02 daiaji

gopass rm -rf is supported and should behave like the unix-tool, except with multiple arguments. Do you have an example where it doesn't?

Currently fuzzy matching is not supported in rm, but I think this could be done.

UPDATE: I'm working with gopass rm with the help of tab-completion, which works great, at least on Bash.

TM2500 avatar Feb 02 '22 08:02 TM2500

Commands with two or more arguments probably fall into this category.

daiaji avatar Feb 03 '22 08:02 daiaji

A workaround could be to use gopass list --flat in combination with grep to select all the secrets you want to remove and then remove them one by one:

$ gopass list --flat | grep 192.168. | while read -r key; do gopass rm -f $key; done

dotcs avatar May 11 '22 07:05 dotcs

This should be patched by #2239 @daiaji Can you try v1.14.3 and report if it now works as expected on your side?

AnomalRoil avatar May 31 '22 09:05 AnomalRoil

I think I will try.

daiaji avatar Jun 01 '22 03:06 daiaji

Feel free to re-open if still relevant.

dominikschulz avatar Dec 24 '22 18:12 dominikschulz