|
| 1 | +<!-- |
| 2 | +Copyright 2021 Arun Donti |
| 3 | +SPDX-License-Identifier: MIT |
| 4 | +--> |
| 5 | +# Text Prepender |
| 6 | + |
| 7 | +[](https://badge.fury.io/py/text-prepender) |
| 8 | + |
| 9 | +Created in mind to add Legal Text to the top of code |
| 10 | + |
| 11 | +text-prepender recursively goes through a specified directory/list of files, and adds text to the top of supported filetypes. |
| 12 | +If there is a filetype that you want to add/know how to add, please make a pull request! |
| 13 | + |
| 14 | +### Parameters |
| 15 | + |
| 16 | +Optional parameters: |
| 17 | + |
| 18 | +| Command Line | Input | Description | |
| 19 | +| -------------------- | -------------------- | ---------------------------------------------------------------------------- | |
| 20 | +| -h, --help | | Get description of text-prepender | |
| 21 | +| -p, --path | dirpath | The path to the directory which text-prepender will start at (default: '.') | |
| 22 | +| -t, --text-file | filepath | The path to the file which text-prepender will start at (default: NOTICE) | |
| 23 | +| -i, --extra-ignores | space delimited list | Additional file paths/names to ignore. Ex. (-i file1 path1 path2) | |
| 24 | +| -v, --enable-verbose | | Flag to turn on verbose logging to list skipped files at the end | |
| 25 | + |
| 26 | +## To Run: |
| 27 | + |
| 28 | +```bash |
| 29 | +# run on all files in current directory |
| 30 | +text-prepender |
| 31 | +# text-prepender --path path/to different directory |
| 32 | +``` |
| 33 | + |
| 34 | +or |
| 35 | + |
| 36 | +```bash |
| 37 | +# run on a specific set of files |
| 38 | +text-prepender file1 path/to/file2 |
| 39 | +``` |
| 40 | + |
| 41 | +`text-prepender --text-file path/to/file` |
| 42 | + |
| 43 | +## pre-commit |
| 44 | + |
| 45 | +If you'd like text-prepender to be run automatically when making changes to files in your Git repository, you can install [pre-commit](https://pre-commit.com/) and add the following text to your repositories' `.pre-commit-config.yaml`: |
| 46 | + |
| 47 | +```yaml |
| 48 | + repos: |
| 49 | + - repo: https://github.com/dontirun/text-prepender |
| 50 | + rev: v0.1.0 # The version of text-prepender |
| 51 | + hooks: |
| 52 | + - id: text-prepender |
| 53 | + # args: |
| 54 | + # - '--text-file' |
| 55 | + # - 'NOTICE' |
| 56 | +``` |
| 57 | +## Manual Build |
| 58 | + |
| 59 | +1. Clone the repo |
| 60 | +2. Build the package |
| 61 | + - `pip install build` |
| 62 | + - `python -m build` |
| 63 | +3. Install the latest version of the package |
| 64 | + - whl |
| 65 | + - `pip install dist/text_prepender-x.x.x-py3-none-any.whl` |
| 66 | + - .tar.gz |
| 67 | + - `pip install dist/text-prepender-x.x.x.tar.gz` |
| 68 | + |
| 69 | +</details> |
0 commit comments