cdown / clipmenu

Clipboard management using dmenu
MIT License
1.14k stars 91 forks source link

clipdel: allow ".*" to print the cache directory to be deleted #174

Closed mehw closed 3 years ago

mehw commented 3 years ago

Hello,

I find useful to print the cache directory that will be deleted by calling clipdel ".*" directly, rather than clipctl cache-dir, before doing an irreversible action via the -d option.

The user could use the pattern "." to print all the cached lines, and ".*" to print the cache directory itself, before completing the operation with the -d option.

This PR also simplifies the code logic (nested conditions) of the clipdel script.

What do you think? Could this be a good idea?

cdown commented 3 years ago

I find useful to print the cache directory that will be deleted by calling clipdel ".*" directly, rather than clipctl cache-dir, before doing an irreversible action via the -d option.

Sorry, could you explain what you mean by that? Not totally sure I understand why one would prever one over the other :-)

mehw commented 3 years ago

Sorry, could you explain what you mean by that? Not totally sure I understand why one would prever one over the other :-)

IMHO it's more informing. If I'm thinking about clipdel to delete the cache directory, I would like to be informed which directory is deleted by clipdel itself, rather than switching to clipctl. This is also what clipdel does when a pattern to delete a line (aka clip) is given, so why not doing the same for the cache directory...

# Print the cache directory.
$ clipctl cache-dir
/tmp/1000-runtime-dir.aER/clipmenu.6.user

# Print what will be deleted.
$ clipdel ".*"
delete cache dir: /tmp/1000-runtime-dir.aER/clipmenu.6.user

# Confirm the deletion.
$ clipdel -d ".*"
cdown commented 3 years ago

Sure, sounds reasonable then, thanks.

mehw commented 3 years ago

Thanks ;)