GPaste icon indicating copy to clipboard operation
GPaste copied to clipboard

Add command to GPaste Client for deleting items via their digests

Open ghost opened this issue 6 years ago • 4 comments

Hello,

I'm using GPaste 3.26.2.

Currently it allows me (or scripts) to delete a single history item via index, for example: gpaste-client delete 0. But while making a script using GPaste Client, I find that I have to travel the history to find the right item and delete it. I do so via gpaste-client get <index> and handle the item value.

So may I ask if you could add command to delete items via their digests (SHA-1, SHA-512...)? My idea is:

gpaste-client delete-via-digest <digest>

Thank you,

ghost avatar Apr 04 '18 02:04 ghost

Hmm, what is the goal of your script?

Wouldn't something like for index in $(gpaste-client search "foo bar" -o | cut -d ':' -f 1); do gpaste-client delete $index; done work?

Keruspe avatar Apr 04 '18 13:04 Keruspe

I think using a digest makes sure the right item is deleted. If multiple processes are calling gpaste-client, then the indexes passing to gpaste-client are not unique.

For example in history there are 2 items:

0. A
1. B

After calling gpaste-client delete 0, A will be deleted, and B now has index of 0.

Maybe you could expose internal database IDs of items - which I think they're unique - to scripts.

My goal is to ensure correct items are deleted. (I'm sorry for the issue title, you can use database IDs or digests as you see fit.)

ghost avatar Apr 04 '18 13:04 ghost

That’s exactly what I was thinking of. I’ll just add an uuid to items and allow deleting by uuid On Wed 4 Apr 2018 at 15:26, hkcorac [email protected] wrote:

I think using a digest makes sure the right item is deleted. If multiple processes are calling gpaste-client, then the indexes passing to gpaste-client are not unique.

For example in history there are 2 items:

  1. A
  2. B

After calling gpaste-client delete 0, A will be deleted, and B now has index of 0.

Maybe you could expose internal database IDs of items - which I think they're unique - to scripts.

My goal is to ensure correct items are deleted. (I'm sorry for the issue title, you can use database IDs or digests as you see fit.)

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Keruspe/GPaste/issues/235#issuecomment-378599144, or mute the thread https://github.com/notifications/unsubscribe-auth/AANm3r2JPV4ODpw6GEQevQGgOmOilU2cks5tlModgaJpZM4TGELP .

Keruspe avatar Apr 04 '18 18:04 Keruspe

Thank you very much. If it's Java I would join and help. But it's C, which I'm not familiar with, I'm sorry... :-(

ghost avatar Apr 04 '18 19:04 ghost