CLI command

skarbiec copy

Make a new item from an existing one — the staging account made like production, the second card of the same bank — without retyping its shape.

Invocation#

Shell
skarbiec copy <id> <new-id> [--without <field,...>]

Purpose#

Make a new item from an existing one — the staging account made like production, the second card of the same bank — without retyping its shape.

Required inputs and options#

  • Requires the item to copy and an id no item, live or trashed, has. --without lists fields the copy leaves out, comma separated, so it can start without the secret. POST /v1/operator/items/copy takes id, to and an optional without.

Output and state effects#

  • Opens the item, drops the --without fields, and writes the rest as a new item of the same kind with the same tags and recipients, as set --if-absent writes one; the original is untouched and the copy's history starts at this write. Appends item-copied naming from, to and the fields left out, and prints ok, from, to, without, created and autofill: for a login, the browser host's grant is widened to the copy as login new widens it, and autofill answers as there (covered, fields, refused, or the reason it was not); for another kind it is null.

Refusals#

  • Anything but two ids exits 2 with `usage: copy <id> <new-id> [--without <field,...>]`, the same id twice with `<id> and the copy have the same id; name a new one`, and a field --without names that the item does not hold with `<id> has no field <field> to leave out`. A new id that exists is refused with `<new-id> already exists, live or trashed; copy creates an item and never replaces one`. An item that will not open fails with its error, and the copy is refused as set refuses a payload its kind does not accept, which is what leaving out a required field is.