/file-merger

Merge text files

Primary LanguagePython

File merger

Merge multiple files into one. Support inserting code as markdown code blocks.

Configuration file

Key Description Default value
files array with input files names 1 -
folder sub-folder, where files located -
output output file name with optional path, relative to config location -
extension extension for all input and output files 2 -
add_file_names add file name before its text, or not false
file_label what write before file name File:
remove_folder extract from 'folder/file.txt' only 'file.txt', for use in file name 3 false
code_in_md write code in markdown file between back-tics ``` with file extension for highlighting false
ask_overwrite ask for overwrite or not false
empty generate empty file by path 4 false
use use this config file or not true

1 All the contents of the files are combined in the order of the files. In this list you can use key text instead of file name for inserting any text between file's content:

files:
  - text: 'some text'

2 If specified, you should write the names of all files without extensions.

3 Used with the add_file_names flag enabled.

4 If specified, no other parameters are needed:

empty: path/to/result/file

Running

python path/to/file_merger.py -f FOLDER -c CONFIG_NAME

-f - Absolute path to folder with project, default is from where script run.

-c - Config file name, default is file-merger.yaml (e.g. folder/config.yaml).