lando / docs

The main docs site for Lando
https://docs.lando.dev/
GNU General Public License v3.0
20 stars 56 forks source link

Give an end user plugin/task creation example. #70

Closed JorisInsign closed 5 years ago

JorisInsign commented 5 years ago

Hello,

Link to the page that needs to be updated or changed. https://docs.lando.dev/contrib/plugins.html

Describe the change you'd like I would like to have more real world end user plugin/tooling creation example. For example : Is it possible to have a plugin "per project" ? In order for example to declare custom tasks but related to this particular project ?

Is it possible to create "tooling" with interactive options but with choices processed via a script ? For exemple : a tool for erasing a directory :

tooling:
  erasedir:
    service: appserver
    description: Erase a directory
    cmd: /app/lando/synclocal.sh
    level: app
    options:
      directory:
        passthrough: true
        describe: Which directory do you want to eras ?
        interactive:
          type: list
          message: Which directory ?
          choices: `find . -maxdepth 1 -type d`

Thanks for your help,

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.

rabauss commented 3 years ago

Maybe someone can help me to implement a custom plugin, which adds a tooling for a bash script. Unfortunately I cannot find a valid example for this case :-(

//~/.lando/plugins/foobar/tasks/foo.js
'use strict';
​
module.exports = lando => ({
    command: 'foo',
    describe: 'foo foo foo',
    cmd: '/helpers/foo.sh',
    service: 'appserver',
    options: {
        'bar': {
            description: 'bar bar bar',
            alias: ['b'],
            boolean: false,
        },
    },
    run: options => {
        if (options.bar) {
            lando.log.warn("TODO Export environment variable 'BAR' for bash script");
            lando.log.warn("TODO Or do I get the bar param in the bash script somehow?");
        }
        lando.log.warn("TODO run bash script /helpers/foo.sh");
    }
});