title isn't set when creating an item with op cli

Yarek
Yarek
Community Member
edited July 2018 in CLI

It seems that its not possible to set the title with the op create item command. Test case:

op create item Login "eyJub3Rlc1BsYWluIjogImZvbyBhY2NvdW50Iiwic2VjdGlvbnMiOiBbXSwiZmllbGRzIjogW3sidmFsdWUiOiAiZm9vIGFjY291bnQiLCJ0eXBlIjogIlQiLCJuYW1lIjogIn
VzZXJuYW1lIiwiZGVzaWduYXRpb24iOiAidXNlcm5hbWUifSx7InZhbHVlIjogImpuNEtSQXFteVgxSENBOEY3UEVTYzE0ck1zMm44R3lmVThYZWMxaWwiLCJ0eXBlIjogIlAi
LCJuYW1lIjogInBhc3N3b3JkIiwiZGVzaWduYXRpb24iOiAicGFzc3dvcmQifV19" --title "foo"

This should create a Login item of this shape:

{"notesPlain": "foo account","sections": [],"fields": [{"value": "foo account","type": "T","name": "username","designation": "username"},{"value": "jn4KRAqmyX1HCA8F7PESc14rMs2n8GyfU8Xec1il","type": "P","name": "password","designation": "password"}]}

Item in the vault comes out as Untitled Login, its overview metadata isn't set:

{
  "uuid": "vwhquekfo2mldkrihra35456qq",
  "templateUuid": "001",
  "trashed": "N",
  "createdAt": "2018-07-19T13:57:46Z",
  "updatedAt": "2018-07-19T13:57:46Z",
  "changerUuid": "S3NG3VULQ5HYTC75CVGMQFFQ7Q",
  "itemVersion": 1,
  "vaultUuid": "i2f45xunzz35pyjkjysowe3uvy",
  "details": {
    "fields": [
      {
        "designation": "username",
        "name": "username",
        "type": "T",
        "value": "foo account"
      },
      {
        "designation": "password",
        "name": "password",
        "type": "P",
        "value": "jn4KRAqmyX1HCA8F7PESc14rMs2n8GyfU8Xec1il"
      }
    ],
    "foo": "bar",
    "notesPlain": "foo account",
    "sections": []
  },
  "overview": {
    "ainfo": "",
    "title": "Untitled Login"
  }
}

I tried passing in Overview section into the encoded JSON to no avail.

$ op --version
0.5

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

Comments

  • cohix
    cohix
    1Password Alumni

    @Yarek It seems that your issue arises from the flag; flags in op are passed as --flag=val, not --flag val :) If you add the =, it works as intended (with the data you provided)

    This is however something we should support, so I've opened issue number 481 to discuss it internally.

  • Yarek
    Yarek
    Community Member

    Oh my, I completely missed that. Thankyou, I can confirm that passing args with = works

  • cohix
    cohix
    1Password Alumni

    Lovely! Thanks.

This discussion has been closed.