WP-CLIwp easy-svg pack list

wp easy-svg pack list

List every collection that can be exported as a pack, with slug, label and icon count, as a table or as JSON, CSV or YAML for scripts and deploy pipelines.

WP-CLI command · Easy SVG Pro · Status: Stable

This command lists every collection you can export as a pack: the free icon library, your icon sets and every folder source. You get the slug, the label and the number of icons. With --format=json the same list is easy to read from a script.

Usage

wp easy-svg pack list [--format=<format>]

When to use it

  • Before wp easy-svg pack export, to find the exact slug to export.
  • In a script that exports every collection of a site, for a backup or to move icons to another site.
  • To compare two sites: list both as JSON and diff them.

For origin and problem counts per collection use wp easy-svg icons list instead.

Parameters

query
--formatoption

The output format, passed straight to WP-CLI's formatter: table (default), json, csv, yaml, count or ids. The option works but is not listed in the command's own help.

Return value

stdouttable|json|csv|yaml

One entry per collection with the fields slug, label and icons (the number of icons). In the order of the pack index, not sorted.

exit codeint

0 on success. 1 when the licence is not active or the WP-CLI feature is off.

Default

--format=table.

Examples

Show the list

wp easy-svg pack list
+----------+-------------+-------+
| slug     | label       | icons |
+----------+-------------+-------+
| easy-svg | Icons       | 12    |
| acme     | ACME        | 48    |
| theme    | Theme icons | 20    |
+----------+-------------+-------+

Export every collection of a site

#!/usr/bin/env bash
set -euo pipefail

mkdir -p packs
for slug in $(wp easy-svg pack list --format=json | jq -r '.[].slug'); do
	wp easy-svg pack export "$slug" --file="packs/$slug.zip"
done

Compare staging and production

wp @staging easy-svg pack list --format=json | jq -S . > staging.json
wp @production easy-svg pack list --format=json | jq -S . > production.json
diff staging.json production.json && echo "Same collections on both sites."

Defensive: check that a slug exists before you use it

SLUG="acme"
if wp easy-svg pack list --format=json | jq -e --arg s "$SLUG" 'any(.[]; .slug == $s)' >/dev/null; then
	wp easy-svg pack export "$SLUG"
else
	echo "No collection called $SLUG on this site." >&2
	exit 1
fi

How it works

The command passes the licence and WP-CLI feature guard, then reads the pack index. That index is built from the full icon inventory, the same one the Packs tab and the pickers use, so the free library appears as easy-svg next to your Pro collections. Each source in it depends on its own feature: icon sets only appear while the Icon set editor feature is on, and theme and drop-in folders only while Theme & folder sources is on.

icons counts the icons the export would write. --format is read straight from the arguments and handed to WP_CLI\Utils\format_items(), so every format WP-CLI supports works.

Pitfalls

  • Undocumented option. --format is read by the code but missing from the command's docblock, so wp help easy-svg pack list does not mention it.
  • A feature that is off hides collections. A missing set or folder usually means its feature is off under Icons → Features.
  • Folders that registered nothing are not listed. A drop-in with a broken manifest has no icons and does not appear. wp easy-svg icons list shows it with a count of 0.
  • Use the slug from here. On older sites an icon set can register under a slug with a -x suffix. Export by the slug this command prints, not by the set's post slug.