truffle exec with arguments
See original GitHub issueCan I pass argument to js script executed using “truffle exec”?
Example:
script.js
module.exports = (callback, arg) => { console.log(arg); callback(); }
exeucution truffle exec “./script.js” “argument”
expected output argument
actual output undefined
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How to pass command line arguments in truffle exec
How to pass command line arguments in truffle exec · Your are on node, so you can use process.argv or any other library...
Read more >Command line options - Truffle Suite
Passing no arguments is equivalent to truffle help , which will display a list of all commands and ... Execute build pipeline (if...
Read more >Truffle commands - DApp develop framework | PlatON
Passing no arguments is equivalent to platon-truffle help , which will display a list of ... platon-truffle exec <script.js> [--network <name>] [--compile].
Read more >truffle exec <script.js> - Fig.io
Arguments ; script.js, JavaScript file to be executed. Can include path information if the script does not exist in the current directory. (required) ......
Read more >Command reference - Truffle Suite
Execute build pipeline (if configuration present) $ truffle build ... truffle exec /path/to/my/script.js ... The @ version parameter syntax is optional.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
bump to reopen. It’s quite annoying to deal with potential variations in executing like:
These should really all do the same thing as far as the script is concerned. It’d be nice to make it easier on the developer and provide an array of arguments. I’d support a function signature that looked like this…
You can use
process.argv
for this, but note the offset - I believe this will be interpreted asnode /path/to/truffle/cli.js exec <args...>
, soargs
start at index 4.Closing this. Feel free to open a new issue for feature requests to expand on this, if it doesn’t meet your needs. Thanks!