tommlnts
v0.4.0
Published
comments template
Downloads
6
Readme
tommlnts
a comments template tool
install
npm install tommlnts -g
usage
tommlnts -j [jsonFile] -t [templateFile] -o [outputFile]
demo
see demo folder
example
json variable value
{
"block comments": ["/* ", " */"],
"line comments": ["// "],
"ssss": ["SSSS"],
"bbbb": ["false"],
"listTestVar": ["A", "B", "C"],
"listTestVal": ["4", "5", ""],
"secss": {
"listTestVar": {
"A": ["aa1", "aa2"],
"B": ["ll1", "ll2"]
}
},
"secss2": {
"secss": {
"aa1": ["aa1*", "aa1$", ""],
"aa2": ["aa2*", "aa2$", "!"],
"ll1": ["ll1*", "ll1$", "@"],
"ll2": ["ll2*", "ll2$", "#"]
}
}
}
template
// test
/* tommlnts remo */
// these code will be remove
const listTestVal = 1;
const bbbb = true;
const gggg2 = 2;
const gggg3 = 3;
const gggg4 = 4;
const gggg5 = 5;
const gggg6 = 6;
const listTestSec = 1;
// tommlnts remo
// tommlnts list ssss bbbb
// tommlnts list listTestVar listTestVal
let slistTestVar = "ssss";
let ilistTestVar = listTestVal;
let blistTestVar = bbbb;
console.log("*", "slistTestVar", slistTestVar);
// tommlnts list secss
console.log("**", "listTestVar", "secss");
// tommlnts list secss2
console.log("***", "listTestVar", "secss", "secss2");
// tommlnts list secss2
// tommlnts list secss
switch (ilistTestVar) {
// tommlnts case listTestVal gggg 2
case gggg2: {
console.log("case 2", blistTestVar, listTestVal);
} break;
// tommlnts case listTestVal gggg 2
// tommlnts case listTestVal gggg 3
case gggg3: {
console.log("case 3", blistTestVar, listTestVal);
} break;
// tommlnts case listTestVal gggg 3
// tommlnts case listTestVal gggg 4
case gggg4: {
console.log("case 4", blistTestVar, listTestVal);
} break;
// tommlnts case listTestVal gggg 4
// tommlnts case listTestVal gggg 5
case gggg5: {
console.log("case 5", blistTestVar, listTestVal);
} break;
// tommlnts case listTestVal gggg 5
// tommlnts case listTestVal gggg 6
case gggg6: {
console.log("case 6", blistTestVar, listTestVal);
} break;
// tommlnts case listTestVal gggg 6
default: {
console.log("default");
} break;
}
// tommlnts list listTestVar listTestVal
// tommlnts list ssss bbbb
// test
output
// test
let sA = "SSSS";
let iA = 4;
let bA = false;
console.log("*", "sA", sA);
console.log("**", "A", "aa1");
console.log("***", "A", "aa1", "aa1*");
console.log("***", "A", "aa1", "aa1$");
console.log("**", "A", "aa2");
console.log("***", "A", "aa2", "aa2*");
console.log("***", "A", "aa2", "aa2$");
console.log("***", "A", "aa2", "!");
switch (iA) {
case 4: {
console.log("case 4", bA, 4);
} break;
default: {
console.log("default");
} break;
}
let sB = "SSSS";
let iB = 5;
let bB = false;
console.log("*", "sB", sB);
console.log("**", "B", "ll1");
console.log("***", "B", "ll1", "ll1*");
console.log("***", "B", "ll1", "ll1$");
console.log("***", "B", "ll1", "@");
console.log("**", "B", "ll2");
console.log("***", "B", "ll2", "ll2*");
console.log("***", "B", "ll2", "ll2$");
console.log("***", "B", "ll2", "#");
switch (iB) {
case 5: {
console.log("case 5", bB, 5);
} break;
default: {
console.log("default");
} break;
}
// test