Skip to main content
go-swarm-icons
On this page

Init & Manifest

Covers flags for scaffolding a config file and indexing a directory's icon names.

init scaffolds a starter Go configuration file showing every provider type, attribute layer, and alias option. manifest generate scans an SVG directory and writes a JSON index of icon names for build tooling or runtime validation.

When to use these commands

New projects: Run init to get a fully commented NewConfig() template instead of writing the builder chain from scratch. Uncomment the providers and options the project needs, delete the rest.

Build pipelines: Run manifest generate to produce a machine-readable list of available icon names from an SVG directory. The output is useful for autocomplete, name validation, or code generation.

init

Write a Go source file containing a commented NewConfig() example. The template covers all provider types (AddDirectory, AddJsonCollection, AddIconifySet, DiscoverJsonSets), attribute layers (DefaultAttributes, PrefixAttributes), aliases, fallbacks, and IgnoreNotFound.

Terminal window
swarm-icons init

Write to a custom path:

Terminal window
swarm-icons init --output config/icons.go

If the output file already exists, the command returns an error. Pass --force to overwrite.

Terminal window
swarm-icons init --force

Flags

Flag Short Type Default Description
--output -o string swarm-icons.go Output file path
--force -f bool false Overwrite an existing file

manifest generate

Load all icons from a local SVG directory and write a sorted JSON file listing their names. The output format is:

JSON
{
"icons": [
"arrow-down",
"arrow-left",
"arrow-right",
"home",
"star"
]
}

Generate a manifest from a directory:

Terminal window
swarm-icons manifest generate --path ./icons

Write to a custom output path:

Terminal window
swarm-icons manifest generate --path ./icons --output assets/icon-list.json

Flags

Flag Short Type Default Description
--path string Path to the SVG icon directory (required)
--output -o string icons.json Output JSON file path

See also

  • JSON Commands: the swarm-icons.json manifest created by init governs json download and json update
  • Config Builder: the NewConfig() fluent builder that the init template demonstrates
  • Directory Provider: the provider that consumes directories indexed by manifest generate
Edit this page

Last updated: