1.0.8 • Published 4 years ago

file_cracker v1.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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
1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago