A simple tool for adding licenses and license headers to your projects.
Project description
licenser-h
A Python tool to add or update license headers in your project files.
Description
licenser-h is a command-line utility designed to automate the process of adding or updating licenses and license headers in your project's source code files. It supports multiple programming languages and license types, ensuring that your code complies with the licensing requirements of your choice.
Features
-
Supports Multiple Licenses :
-
MIT License
-
Apache License 2.0
-
GNU General Public License v3.0
-
BSD 2-Clause Simplified License
-
-
Multi-language Support :
- Python, Shell Script, C, C++, Java, JavaScript, C#, Go, Ruby, PHP, HTML, XML, CSS, and more.
-
Automatic Detection and Replacement :
-
Detects existing license headers and replaces them.
-
Only updates the license header at the top of the file without affecting other comments.
-
-
Customizable Placeholders :
- Inserts custom values representing the current year, project name, and author name.
Installation
Prerequisites
-
Python 3.6 or higher
-
pippackage manager Usingsetup.pyYou can install licenser-h by cloning the repository and running thesetup.pyscript:
# Clone the repository
git clone https://github.com/yummydirtx/licenser-h.git
cd licenser-h
# Install the package
python -m pip install .
Using pip
licenser-h is available on PyPI, you can install it directly:
pip install licenser-h
Usage
Command-Line Interface
Run the licenser-h tool from your command line:
licenser-h
Example Interaction
Select a license:
❯ MIT License
Apache License 2.0
GNU General Public License v3.0
BSD 2-Clause Simplified License
Enter the project name: MyAwesomeProject
Enter the author name: Jane Doe
After providing the necessary information, licenser-h will:
-
Generate a
LICENSEfile in your project's root directory. -
Add or update license headers in all supported source code files within your project.
Supported File Extensions
licenser-h automatically detects files with the following extensions:
-
Script Languages :
.py,.sh,.rb,.php -
Compiled Languages :
.c,.cpp,.h,.java,.cs,.go -
Web Technologies :
.js,.html,.xml,.css -
Others : Additional language support is coming!
How It Works
-
License Selection : Prompts you to select a license from the supported options.
-
User Information : Asks for the project name and author name.
-
License Text Generation : Uses the provided information to generate the full license text and license header, replacing placeholders.
-
File Processing :
-
Walks through the project directory.
-
Detects files with supported extensions.
-
Adds or updates the license header at the top of each file.
- Existing License Detection :
-
Detects existing license headers by matching patterns, even if placeholder values are unknown.
-
Replaces the old license header with the new one without affecting other comments or code.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! If you have suggestions for improvements or encounter any issues, please feel free to open an issue or submit a pull request.
Steps to Contribute
-
Fork the repository.
-
Create a new branch for your feature or bugfix.
-
Commit your changes with descriptive messages.
-
Push the branch to your forked repository.
-
Open a pull request against the main branch.
Contact
For questions or support, please contact theJunkyard webadmin.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file licenser_h-1.1.tar.gz.
File metadata
- Download URL: licenser_h-1.1.tar.gz
- Upload date:
- Size: 26.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6973de1cead78a7daa844698fc258895ee22ba1c6d482f6b8a7e8b50a6c63542
|
|
| MD5 |
cff53668560b391fd04d3fbb9fbf0ae7
|
|
| BLAKE2b-256 |
cb2dc19f2e413f05eacb7a265242a9f3ba1f34496df8e3361ffde4a84c8f1bb5
|
File details
Details for the file licenser_h-1.1-py3-none-any.whl.
File metadata
- Download URL: licenser_h-1.1-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2e8633cdccabe735cfc5af44dda73869c80781da8221e2f46cc1f40a98ad44b
|
|
| MD5 |
05e204345339c1f6823744da8488d54d
|
|
| BLAKE2b-256 |
e5a924b79c5e4170a707523095bc8f93dfad577c5aa2935e7fbbbbdf539e0ba6
|