You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is something that pyonepassword could be helpful for without too much work.
The op command can take a list of JSON objects via stdin, which should work with the output (or some modified form) of op item list. We already have item_list(self, categories=[], include_archive=False, tags=[], vault=None), so something like:
basically, I've added _OPCommandInterface._item_delete_batch(), and tried it out by doing the following:
get a list of item descriptors from "Test Data 3"
break the list up into the first 25 objects and the rest
serialize the first batch to json
call _item_delete_batch()
serialize the second batch to json
call _item_delete_batch()
It seems to work, but it remains to be seen if it's faster than deleting the items one at a time.
In [5]: vault = "Test Data 3"
In [6]: for i in range(0, 30):
...: title=f"Example Login Item {i:02d}"
...: username=f"user_{i:02d}"
...: password = LETTERS_DIGITS_SYMBOLS_20
...: op.login_item_create(title, username, password=password, vault=vault)
...:
In [7]: items = op.item_list(vault=vault)
In [13]: batch_1=items[0:25]
In [14]: batch_2=items[25:]
In [16]: batch_str=json.dumps(batch_1)
In [18]: op._item_delete_batch(batch_str, vault)
In [19]: batch_str=json.dumps(batch_2)
In [20]: op._item_delete_batch(batch_str, vault)
A user on the 1Password community forums asked if there was a faster way of using the
op
CLI tool to delete everything in a vault:https://1password.community/discussion/comment/664638
I think this is something that
pyonepassword
could be helpful for without too much work.The
op
command can take a list of JSON objects via stdin, which should work with the output (or some modified form) ofop item list
. We already haveitem_list(self, categories=[], include_archive=False, tags=[], vault=None)
, so something like:... shouldn't be too much trouble
The text was updated successfully, but these errors were encountered: