file_cracker
v1.0.8
Published
Flexible file batch package, template supported.
Downloads
3
Readme
file_cracker
Flexible file batch package, template supported.
Installation
$ npm i -g file_cracker
Usage
Create File
if file already exists, won't do anything
if you want to create a directory, please
filename
ends with '/'
config.json
[
"aaa/bbb/",
"ccc/1.txt",
"2.txt"
]
command
$ file_crack config.json
output
file created: 2.txt
file created: ccc/1.txt
directory created: aaa/bbb/
Specifies Filename With Command Line Parameters
- {%
digit
%} specifies command line parameter
config.json
[
"aaa/{%1%}/",
"{%2%}/x{%3%}y.txt"
]
command
$ file_cracker config.json aaa bbb ccc
output
create file: bbb/xcccy.txt
create directory: aaa/aaa/
Create File With Template
config.json
{
"1.txt": {
"template": "template.txt"
}
}
template.txt
xxx
command
$ file_cracker config.json
output
create file: 1.txt from template: template.txt
generated file
xxx
Render Template
To File
config.json
{
"1.txt": {
"template": "template.txt",
"dict": {
"v1": "value1",
"v2": "value2"
}
}
}
template.txt
xxx
{%1%}
{%2%}
{%3%}
{%v1%}
{%v2%}
command
$ file_cracker config.json aaa bbb ccc
output
create file: 1.txt from template: template.txt
generated file
xxx
aaa
bbb
ccc
value1
value2