Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

run plugin example and documentation #1396

Open
rocky opened this issue Nov 27, 2018 · 7 comments
Open

run plugin example and documentation #1396

rocky opened this issue Nov 27, 2018 · 7 comments

Comments

@rocky
Copy link
Contributor

rocky commented Nov 27, 2018

The section in "truffle run " is sparse in useful documentation. First, most plugins are going to want to use the config parameter that passed in. hello.js omits this parameter, and probably some mention should be made that it exists.

There there should probably be mention as to how flags/switches get passed to the plugin and how command arguments are passed. Here is a more complete hello.js example, that might be reworked into more expanded documentation:


/**
 * A sample truffle run plugin.
 *
 * @param config a truffle configuration object. It has attributes
 *               like `truffle_directory`, `working_directory`, etc.
 *
 */
module.exports = (config) => {
  // If --help is given `config.help` will be set.
  if (config.help) {
    console.log("usage: truffle run hello [name]")
  } else {
    // config._ has the command arguments. config_[0] is
    // the command name, e.g. "hello" here. config_[1]...
    // starts remaining parameters.
    let name = config._.len > 1 ? config._[1] : 'World!'
    console.log(`Hello, ${name}`)
  }
}
@stale
Copy link

stale bot commented Jan 26, 2019

Thank you for raising this issue! It has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you would like to keep this issue open, please respond with information about the current state of this problem.

@stale
Copy link

stale bot commented Feb 3, 2019

There has been no new activity on this issue since it was marked as stale 7 days ago, so it is being automatically closed. If you'd like help with this or a different problem, please open a new issue. Thanks!

@stale stale bot closed this as completed Feb 3, 2019
@gnidan gnidan reopened this Feb 3, 2019
@gnidan
Copy link
Contributor

gnidan commented Feb 3, 2019

stop it stalebot

@stale
Copy link

stale bot commented Feb 10, 2019

There has been no new activity on this issue since it was marked as stale 7 days ago, so it is being automatically closed. If you'd like help with this or a different problem, please open a new issue. Thanks!

@stale stale bot closed this as completed Feb 10, 2019
@eggplantzzz eggplantzzz reopened this Feb 21, 2019
@stale
Copy link

stale bot commented Feb 21, 2019

Thanks for your response! This issue is no longer considered stale and someone from the Truffle team will try to respond as soon as they can.

@gnidan
Copy link
Contributor

gnidan commented Feb 27, 2019

Seems like the only thing left here is expanding the Third Party Command Plugin docs to include the above re: flags

@rkalis
Copy link
Contributor

rkalis commented Aug 7, 2019

I added a reference of the config object and a walkthrough plugin development in my blog post https://kalis.me/creating-truffle-plugins/. If you want, I can contribute some of that content to the Truffle docs if you know what you want to include on the page.

@haltman-at haltman-at transferred this issue from trufflesuite/truffle Feb 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants