wer patch

Update specific fields of a resource without opening an editor.

Usage

wer patch <type> <name> [KEY=VALUE ...] [-p JSON]

Description

The patch command updates individual fields of a resource directly from the command line. Unlike wer edit, which opens the full resource definition in an editor, patch lets you make targeted changes using dot-notation KEY=VALUE pairs or a JSON merge patch. This is ideal for scripting and quick one-off modifications.

With dot-notation, values are automatically inferred as numbers, booleans, or strings. Use =null to remove a field. You can also use -p to provide a JSON merge patch (RFC 7386) for more complex updates.

Arguments

Argument Description
type The type of resource to patch (workstation, workstationconfig, or sshkey)
name The name of the resource to update
KEY=VALUE One or more dot-notation field assignments

Flags

Flag Description
-p, --patch JSON merge patch body (cannot be combined with KEY=VALUE arguments)
--stop Stop the workstation before patching and start it after. Useful for changes that require a restart (e.g., machine type, disk size). Only applies to workstations

Examples

# Update disk size using dot-notation
wer patch workstation my-vm spec.resources.diskSize=100

# Update multiple fields at once
wer patch ws my-vm spec.resources.cpu=4 spec.resources.memory=8

# Add a label
wer patch ws my-vm metadata.labels.env=staging

# Remove a field (set to null)
wer patch ws my-vm spec.sshKeyRef=null

# JSON merge patch
wer patch workstation my-vm -p '{"spec":{"resources":{"diskSize":100}}}'

# Change machine type (stop, patch, restart automatically)
wer patch ws my-vm spec.providerConfig.machineType=t3.large --stop