actionComment
Matipulate files, text or scripts, enabling the modification of pre-defined blocks with intelligent comments.
Reason
Need a handler to modify scripts according to need, before running the build
Use
myFile.txt
#!addName:startMy name is #name,your nameis #name too.#!addName:end My name is Jack,your nameis #!insertName too.
example.js
Result
My name is Martin,your nameis Martin too. My name is Jack,your nameis Jack too.
Create handles
Handlers receive the following parameters:
- content:
String
- line:
Int
line number - position:
array
: [init position, end position]
They may return a promise
Handler example
{ return line} { return line}
CLI
action-comment [target: path] --handler [path] --output [path] --tag [string]
- target: Target file
- output: File that will be created, if nothing happens, exit stdout.
- handler: Nodejs module with handlers
- tag: Comment tag