mrichar1/clipster

Allow to save specific clipboard history item(s) to file and edit and retrieve those.

ibizaman opened this issue · 1 comments

I would find it neat to have clipster allow me to save a clipboard history item and associate a name to it.

On the command line, I see the following changes, add:

-w, --save PATTERN NAME
# Save all matching line history number under NAME

-e, --edit NAME
# Opens $EDITOR with the saved clipboard history as content

Update:

-o [NAME], --output [NAME]  Output last selection from history (or more, see -n) or saved clipboard history if NAME is given.

I totally agree that this could be done with just a hint of batch scripting, saving can be done with:

clipster -n 0 | grep PATTERN > ~/.config/clipster/saved/NAME

Editing with

$EDITOR ~/.config/clipster/saved/NAME

Copying back with:

clipster --ignore && clipster < ~/.config/clipster/saved/NAME

What I don't like about this last solution is the need to use grep, clipster daemon should be able to accept a PATTERN option so that it doesn't need to send everything back to the client.
That being said, I just would find it neater to be integrated.
What do you think? I'm okay to propose a PR.

Hi,

Thanks for your issue - I've been pondering it for a while, but wasn't quite sure how to proceed.

I ended up deciding that the feature you have requested is a bit too specific, and that command-lining chaining is mostly a good thing.

However it is true that having to grep over the whole server output is a little messy, so I have made a change to improve this - now in 1.1.0.

clipster now supports a -S | --search option. This takes a regex which acts as a filter on what the server will return. Note that it also interacts 'properly' with the -n option.

For example, if your history contained: ['cat', 'dog', 'sophisticated', 'cow', 'wildcat', 'fish']

$ clipster -S cat
wildcat

$ clipster -S cat -n 2
wildcat
sophisticated

$ clipster -S cat\\$
wildcat

$ clipster -S cat\\$ -n 2
wildcat
cat

Please let me know if this is going to be enough to do the kinds of things you envisage with clipster