Skip to main content

Add text (like legal text) to the top of code without breaking it.

Project description

Text Prepender

PyPI version

Created in mind to add Legal Text to the top of code

text-prepender recursively goes through a specified directory/list of files, and adds text to the top of supported filetypes. If there is a filetype that you want to add/know how to add, please make a pull request!

Parameters

Optional parameters:

Command Line Input Description
-h, --help Get description of text-prepender
-p, --path dirpath The path to the directory which text-prepender will start at (default: '.')
-t, --text-file filepath The path to the file which text-prepender will start at (default: NOTICE)
-i, --extra-ignores space delimited list Additional file paths/names to ignore. Ex. (-i file1 path1 path2)
-v, --enable-verbose Flag to turn on verbose logging to list skipped files at the end

To Run:

# run on all files in current directory
text-prepender
# text-prepender --path path/to different directory

or

# run on a specific set of files
text-prepender file1 path/to/file2

text-prepender --text-file path/to/file

pre-commit

If you'd like text-prepender to be run automatically when making changes to files in your Git repository, you can install pre-commit and add the following text to your repositories' .pre-commit-config.yaml:

  repos:
  - repo: https://github.com/dontirun/text-prepender
      rev: v0.1.0 # The version of text-prepender
      hooks:
      - id: text-prepender
      #  args:
      #    - '--text-file'
      #    - 'NOTICE'

Manual Build

  1. Clone the repo
  2. Build the package
    • pip install build
    • python -m build
  3. Install the latest version of the package
    • whl
      • pip install dist/text_prepender-x.x.x-py3-none-any.whl
    • .tar.gz
      • pip install dist/text-prepender-x.x.x.tar.gz

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

text-prepender-0.1.0.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

text_prepender-0.1.0-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page