https://github.com/holzhaus/sourceheaders
Adds or replaces header comments (usually containing licensing information) in source files.
https://github.com/holzhaus/sourceheaders
Last synced: 6 months ago
JSON representation
Adds or replaces header comments (usually containing licensing information) in source files.
- Host: GitHub
- URL: https://github.com/holzhaus/sourceheaders
- Owner: Holzhaus
- License: mit
- Created: 2022-03-09T14:22:26.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-01T21:56:00.000Z (almost 3 years ago)
- Last Synced: 2025-06-21T06:04:04.020Z (6 months ago)
- Language: Python
- Size: 153 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# sourceheaders
Adds or replaces header comments (usually containing licensing information) in
source files.
## Configuration
You can configure *sourceheaders* by placing a `.sourceheaders.toml` file into
your project root.
```toml
[general]
license = "MPL-2.0"
copyright_holder = "John Doe "
prefer_inline = true
width = 70
[language.rust]
width = 99
```
## Usage
### Command line
You can run *sourceheaders* manually on the command line and pass one or more
file paths.
```shell-session
$ sourceheaders /path/to/file.py /path/to/other/file.rs
Added header to /path/to/file.py
Replaced header in /path/to/other/file.rs
```
### Pre-commit
*sourceheaders* can be used with [pre-commit](https://pre-commit.com).
Add the following lines to your `.pre-commit-config.yaml`:
```yaml
- repo: https://github.com/Holzhaus/sourceheaders
rev: ""
hooks:
- id: sourceheaders
```
Either specify a specific hook version in the `rev` field directly, or run the
this command to automatically fill in the latest version:
```shell-session
$ pre-commit autoupdate --repo "https://github.com/Holzhaus/sourceheaders"
Updating https://github.com/Holzhaus/sourceheaders ... updating -> .
```