Commands
legato templates lists the bundled templates. legato templates <service> prints one service's template, with the inputs it asks for.
legato install <service> --set name=value ... [--dry-run] [--copy] adds a service's pages from its template. Give --set once for each input. A value can contain =. With --dry-run the command prints what it would do and writes nothing.
If one of the template's pages is already in your Pages folder, install is refused with already_installed, and the message names the pages. --dry-run is refused the same way. Add --copy to install a numbered set beside them, such as a second Pi-hole: its pages are titled Pi-hole 2, their ids end in -2, and their links and history are their own. It signs in with its own secret, pihole-2, which the setup commands name.
templates and install --dry-run print JSON on stdout. An install prints its result as JSON on stdout too, and also writes the preview and the setup commands to stderr. A refusal prints {"error": {...}} on stdout and exits with status 1. A templates or install command with a missing or extra argument is refused with the code failed.
See Add a page from a template.
Examples and success output
legato templates
legato templates portainer
legato install portainer --set url=https://example.com --set env=1 --dry-runThe first command prints {"templates": [...]}, with each template's service, title, category, summary, version and pages. The second prints the whole Portainer template, including its inputs, secrets and lists.
The dry run prints service, dry_run, preview, setupSteps, setup_commands and written_pages, which is empty. A template that adds two or more pages to the sidebar also has section: the name of the section they go in, the template's title. preview has four parts:
pages: the pages the install would write.hosts: the hosts those pages contact.polling: how often each source checks.actions: the buttons that send a request.
setup_commands holds one command for each thing the pages need from you:
- For each secret,
/Applications/Legato.app/Contents/MacOS/Legato secret set NAME --host HOST. Run it and type the credential, or pipe it in. See Legato secret. - For each list the pages check, a
legato lists set NAME --if-missing -command that creates the list with the template's suggested entries. A list you already have is kept. See Lists.
To install, run the command without --dry-run, with your own Portainer address and environment id in place of the example values:
legato install portainer --set url=https://example.com --set env=1This writes two pages, portainer-container and portainer. The result has the same fields as the dry run, with dry_run set to false and the two ids in written_pages. Then run the setup_commands. If a page can't be written partway through, the error is install_failed, and details.written_pages names the pages that were written.
To remove the pages again:
legato delete portainer
legato delete portainer-containerThis moves the two pages to the Trash. A secret or a list that you made with the setup_commands stays. Remove those with Legato secret delete and legato lists delete, unless the list was yours before the install.