Overwrite a document via the CLI?

HippoMan
HippoMan
Community Member

Via the CLI, there any way to overwrite a previously created document with an updated version of that document?

I know I could delete the document and then re-create it, but then, the original document ends up in the Trash folder, and if I reference the document after that via the CLI, I have to use its UUID and not its name, since both the original and the new document are shown as existing. This adds a lot of complexity to what, in my opinion, should be nothing more than a simple overwrite operation.

If I could empty the Trash via the CLI, I could then do the following:

(1) delete the original document via the CLI
(2) re-create the updated document by name via the CLI
(3) empty the Trash via the CLI

But step (3) seems to be impossible (see my other recent message here about this topic).

Any ideas of how I could overwrite a document via the CLI without this level of complexity?

Thank you.


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided

Comments

  • Hi @HippoMan,

    It’d be great if this was possible, but currently there’s no way to do it due to the fact that you can’t edit an existing item. We aren’t happy with how item management works in the CLI and we want to rethink it.

    Rick

  • HippoMan
    HippoMan
    Community Member

    Yes, replacing an existing item via the CLI would indeed be a useful and helpful feature.

  • AGAlumB
    AGAlumB
    1Password Alumni

    Thanks for letting us know! :)

  • patallan
    patallan
    Community Member

    Just adding another voice in support of updating/replacing items and documents. I've got things working well enough with a delete-old/create-new workflow, but I'd much rather not be filling up the trash.

  • Naturally. It's most definitely something we want to make possible.

    Rick

  • arathunku
    arathunku
    Community Member

    Hey @rickfillion, is there any update on this? Additionally, is there any way to receive document's original file name in CLI client? I'm currently working on a script to backup/sync 1password and it looks like CLI 1password client is very limited.

  • Hey @arathunku,

    I have no update to share with respect to updating a document via the CLI. We've been having a lot of discussions internally about item manipulation lately.

    Regarding getting the original filename, it should be available to you via op get item, under details.documentAttributes.

    I hope that helps.

    Rick

  • Kohsuke
    Kohsuke
    Community Member

    I was looking into 1Password CLI so that we can script a sharing/updating of a team-shared secret, and discovered it's not possible to update a document. Ouch!

    Really looking forward to seeing this capability in the CLI, especially given that in the web UI I can upload a new file to replace an existing document...

  • Thanks for the feedback on this @Kohsuke. :)

    Ben

  • felix_1p
    felix_1p
    1Password Alumni

    Since v1.7.0 one can use the op edit document command the replace the existing file with new one. https://app-updates.agilebits.com/product_history/CLI#v1070001

This discussion has been closed.