Templates
A template is a set of actions and terminals you reuse across some projects but not all — the Rails tools for your Rails apps, say. Save it in
~/.lpm/templates/ and pull it in by name with extends.Writing a template. A template holds only actions, with terminals written as type: terminal:
~/.lpm/templates/rails-tools.yml
actions:
logs:
cmd: tail -f log/development.log
type: terminal
reuse: true # one pane, reused on every click
console:
cmd: bin/rails console
type: terminal
routes: bin/rails routes
Using it. List templates in extends in a project file, .lpm.yml, or global.yml. The file that extends wins field by field, so you can change one command and keep the rest:
~/.lpm/projects/shop.yml
name: shop
root: ~/Projects/shop
extends: [rails-tools] # ~/.lpm/templates/rails-tools.yml
services:
web: bin/rails server
actions:
logs:
cmd: tail -f log/test.log # overrides the template's command
Good to know
With several templates, the earlier one in the list wins. A template’s own extends is not followed, and a name with no matching file is skipped.