{"id":45900611,"url":"https://github.com/marslo/cr-manager","last_synced_at":"2026-05-07T03:05:42.693Z","repository":{"id":288687852,"uuid":"968904871","full_name":"marslo/cr-manager","owner":"marslo","description":"the pre-commit hook to add/update/delete the copyright header in files/folders","archived":false,"fork":false,"pushed_at":"2026-02-23T17:59:37.000Z","size":2064,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-24T00:59:06.913Z","etag":null,"topics":["copyright","pre-commit-copyright","pre-commit-hook","pre-commit-hooks"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/cr-manager","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marslo.png","metadata":{"files":{"readme":"README.PYPI.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-19T00:40:41.000Z","updated_at":"2026-02-07T02:24:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"8bcced3b-fd7a-498b-bda1-893e1bd8ee1f","html_url":"https://github.com/marslo/cr-manager","commit_stats":null,"previous_names":["marslo/cr-manager"],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/marslo/cr-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marslo%2Fcr-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marslo%2Fcr-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marslo%2Fcr-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marslo%2Fcr-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marslo","download_url":"https://codeload.github.com/marslo/cr-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marslo%2Fcr-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29917802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"ssl_error","status_checked_at":"2026-02-27T19:37:41.463Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["copyright","pre-commit-copyright","pre-commit-hook","pre-commit-hooks"],"created_at":"2026-02-27T22:37:13.808Z","updated_at":"2026-05-07T03:05:42.686Z","avatar_url":"https://github.com/marslo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/marslo/cr-manager/main.svg)](https://results.pre-commit.ci/latest/github/marslo/cr-manager/main) [![publish to PyPI](https://github.com/marslo/cr-manager/actions/workflows/publish.yml/badge.svg)](https://github.com/marslo/cr-manager/actions/workflows/publish.yml) [![semantic-release](https://github.com/marslo/cr-manager/actions/workflows/semantic-release.yml/badge.svg?branch=main)](https://github.com/marslo/cr-manager/actions/workflows/semantic-release.yml)\n\n---\n\n# cr-manager -- the Copyright Header Manager\n\nA tool to automatically **add**, **update**, or **delete** multi-format copyright headers in source files.\n\n---\n\n- [Features](#features)\n- [How to Contribute](#how-to-contribute)\n- [Action Modes](#action-modes)\n  - [Add New Copyright Headers](#add-new-copyright-headers)\n  - [Update Existing Copyright Headers](#update-existing-copyright-headers)\n  - [Delete Existing Copyright Headers](#delete-existing-copyright-headers)\n  - [Debug Mode](#debug-mode)\n  - [Supported File Types and Formats](#supported-file-types-and-formats)\n  - [pre-commit hook](#pre-commit-hook)\n- [Install](#install)\n  - [Binary](#binary)\n  - [bash completion](#bash-completion)\n- [Help Message](#help-message)\n\n---\n\n# Features\n\n- **Add**: Insert copyright headers for multiple file types.\n- **Update**: Force update or insert headers if missing.\n- **Check**: Verify the presence and correctness of headers.\n- **Delete**: Remove detected copyright headers from files.\n- Supports recursive directory traversal and filetype auto-detection or override.\n- Supports combined author-info and copyright headers.\n\n---\n\n# [How to Contribute](https://github.com/marslo/cr-manager/blob/main/CONTRIBUTING.md)\n\n---\n\n# Action Modes\n\n\u003e without any action mode specified, the default action is to **add** copyright headers.\n\n| OPTION     | DESCRIPTION                                                                 |\n| ---------- | --------------------------------------------------------------------------- |\n|            | Add mode: Automatically adds copyright headers to files (default).          |\n| `--add`    | Add mode: Automatically adds copyright headers to files (default).          |\n| `--check`  | Check mode: Verifies file copyright status (match, mismatch, or not found). |\n| `--delete` | Delete mode: Removes detected copyright headers from files.                 |\n| `--update` | Update mode: Forces replacement of copyright or adds it if missing.         |\n\n\n## Add New Copyright Headers\n```bash\n# single file\n$ cr-manager /path/to/file\n# or\n$ cr-manager --add /path/to/file\n\n# files recursively in directories\n$ cr-manager --recursive /path/to/directory\n# or\n$ cr-manager --add --recursive /path/to/directory\n\n# add to non-supported suffixes with supplied filetype\n# -- e.g. add to .txt files as python files --\n$ cr-manager --filetype python /path/to/file.txt\n# or\n$ cr-manager --add --filetype python /path/to/file.txt\n```\n\n## Update Existing Copyright Headers\n\n\u003e `--filetype \u003cTYPE\u003e` can be used to force a specific filetype for the update action, overriding auto-detection.\n\n```bash\n# single file\n$ cr-manager --update /path/to/file\n\n# files recursively in directories\n$ cr-manager --update --recursive /path/to/directory\n```\n\n## Delete Existing Copyright Headers\n\n\u003e `--filetype \u003cTYPE\u003e` can be used to force a specific filetype for the delete action, overriding auto-detection.\n\n```bash\n# single file\n$ cr-manager --delete /path/to/file\n\n# files recursively in directories\n$ cr-manger --delete --recursive /path/to/directory\n```\n\n## Debug Mode\n\n```bash\n# *add* without modifying files\n$ cr-manager --debug /path/to/file\n# or\n$ cr-manager --add --debug /path/to/file\n\n# *update* without modifying files\n$ cr-manager --update --debug /path/to/file\n\n# *delete* without modifying files\n$ cr-manager --delete --debug /path/to/file\n```\n\n## Supported File Types and Formats\n\n\u003e - check [Running as CLI tool](https://github.com/marslo/cr-manager?tab=readme-ov-file#running-as-cli-tool)\n\n|                    FILETYPE                   |           SUFFIXES          |\n|:---------------------------------------------:|:---------------------------:|\n| `python`, `shell`, `bash`, `sh`, `dockerfile` | `.py`, `.sh`, `.dockerfile` |\n\n```\n$ cr-manager --filetype python\n# ============================================================================ #\n# Copyright © 2026 marslo                                                      #\n# Licensed under the MIT License, Version 2.0                                  #\n# ============================================================================ #\n```\n\n![Python](https://github.com/marslo/cr-manager/raw/main/screenshots/ft-py.png)\n\n---\n\n|                  FILETYPE                 |      SUFFIXES      |\n|:-----------------------------------------:|:------------------:|\n| `jenkinsfile`, `groovy`, `gradle`, `java` | `.groovy`, `.java` |\n\n```\n$ cr-manager --filetype groovy\n/**\n *******************************************************************************\n * Copyright © 2026 marslo                                                     *\n * Licensed under the MIT License, Version 2.0                                 *\n *******************************************************************************\n**/\n```\n\n![java-groovy](https://github.com/marslo/cr-manager/raw/main/screenshots/ft-java-groovy.png)\n\n---\n\n|                   FILETYPE                  |                  SUFFIXES                  |\n|:-------------------------------------------:|:------------------------------------------:|\n| `c`, `cpp`, `c++`, `cxx`, `h`, `hpp`, `hxx` | `.c`, `.cpp`, `.cxx`, `.h`, `.hpp`, `.hxx` |\n\n```\n$ cr-manager --filetype cpp\n/**\n * Copyright © 2026 marslo\n * Licensed under the MIT License, Version 2.0\n */\n```\n\n![c/cpp](https://github.com/marslo/cr-manager/raw/main/screenshots/ft-cpp.png)\n\n---\n\n## pre-commit hook\n\n```yaml\n# if `COPYRIGHT` file can be found in the root directory of this repository\n---\nrepos:\n  - repo: https://github.com/marslo/cr-manager\n    rev: v3.2.0\n    hooks:\n      - id: cr-manager\n        args: [\"--update\"]\n```\n\n```yaml\n# specify the path to the COPYRIGHT file\n---\nrepos:\n  - repo: https://github.com/marslo/cr-manager\n    rev: v3.2.0\n    hooks:\n      - id: cr-manager\n        args: [\"--update\", \"--copyright\", \"/path/to/COPYRIGHT\"]\n        files: ^(jenkinsfile/|.*\\.(groovy|py|sh)$)\n```\n\n```yaml\n# only check the copyright headers without modifying files after commit\n---\nrepos:\n  - repo: https://github.com/marslo/cr-manager\n    rev: v3.2.0\n    hooks:\n      - id: cr-manager\n        args: [\"--check\"]\n        stages: [post-commit]\n```\n\n---\n\n# Install\n## Binary\n\n\u003e - pipx installation ( [how to install pipx](https://pipx.pypa.io/stable/how-to/install-pipx/) )\n\u003e   ```bash\n\u003e   $ python3 -m pip install pipx\n\u003e   $ python3 -m pipx ensurepath\n\u003e   ```\n\u003e - enable the ansicolor in Windows terminal for better output experience.\n\u003e   ```batch\n\u003e   \u003e reg add HKCU\\Console /v VirtualTerminalLevel /t REG_DWORD /d 1\n\u003e   ```\n\n```bash\n# via pipx\n$ pipx install --force \"git+https://github.com/marslo/cr-manager\"\n# via pip\n$ python3 -m pip install cr-manager\n\n# with binary\n$ VERSION=\"$(curl -fsSL https://api.github.com/repos/marslo/cr-manager/releases/latest | jq -r .tag_name)\"\n# -- linux --\n$ curl -fsSL -o cr-manager https://github.com/marslo/cr-manager/releases/download/${VERSION}/cr-manager-linux\n# macos\n$ curl -fsSL -o cr-manager https://github.com/marslo/cr-manager/releases/download/${VERSION}/cr-manager-macos\n# Windows - running in cmd\n\u003e powershell -NoProfile -Command \"$v=(Invoke-WebRequest -Uri 'https://api.github.com/repos/marslo/cr-manager/releases/latest' -UseBasicParsing | ConvertFrom-Json).tag_name; Invoke-WebRequest -Uri ('https://github.com/marslo/cr-manager/releases/download/'+$v+'/cr-manager.exe') -OutFile 'cr-manager.exe'; Write-Host ('Downloaded '+$v)\"\n```\n\n## bash completion\n\n\u003e automatically detect the OS and install bash completion to the appropriate directory:\n\u003e - macos: $(brew --prefix)/etc/bash_completion.d → $XDG_DATA_HOME/.local/share →  ~/.bash_completion.d\n\u003e - linux: $XDG_DATA_HOME/.local/share → ~/.bash_completion.d → /usr/share/bash-completion/completions → /etc/bash_completion.d\n\n```bash\n# macos\n$ cr-manager --install-completion\n# or install manually\n$ cr-manager --completion | tee \"$(brew --prefix)/etc/bash_completion.d/cr-manager\"\n```\n\n```bash\n# linux user folder\n$ cr-manager --install-completion\n# or install manually\n$ cr-manager --completion | tee ~/.bash_completion.d/cr-manager\n\n# linux system folder (requires sudo)\n$ sudo cr-manager --install-completion\n# or install manually\n$ cr-manager --completion | sudo tee /etc/bash_completion.d/cr-manager\n```\n\n```bash\n# uninstall\ntest -f ~/.bash_completion.d/cr-manager \u0026\u0026 rm -rf ~/.bash_completion.d/cr-manager\ntest -f /etc/bash_completion.d/cr-manager \u0026\u0026 sudo rm -rf /etc/bash_completion.d/cr-manager\n[[ 'Darwin' = \"$(uname -s)\" ]] \u0026\u0026 test -f \"$(brew --prefix)/etc/bash_completion.d/cr-manager\" \u0026\u0026 rm -rf \"$(brew --prefix)/etc/bash_completion.d/cr-manager\"\n```\n\n# Help Message\n\n```bash\n$ cr-manager --help\nUSAGE:\n  cr-manager [--add | --check | --delete | --update] [--copyright FILE] [--filetype TYPE] [--recursive]\n             [--debug] [--verbose] [--completion] [--install-completion] [--help] [--version]\n             FILES ...\n\nA tool to automatically add, update, or delete multi-format copyright headers.\n\nPOSITIONAL ARGUMENTS:\n  FILES ...                 List of target files or directories to process.\n\nACTION MODES:\n  -a, --add                 Add mode: Adds copyright header to files that are missing it (default).\n  -c, --check               Check mode: Verifies file copyright status (match, mismatch, or not found).\n  -d, --delete              Delete mode: Removes detected copyright headers from files.\n  -u, --update              Update mode: Forces replacement of copyright or adds it if missing.\n\nOPTIONS:\n  --copyright FILE          Specify the copyright template file path (default: COPYRIGHT).\n  -t, --filetype TYPE       Force override a filetype instead of auto-detection.\n                            If provided, displays a formatted preview for that type. Supported: bash, c,\n                            c++, cpp, cxx, dockerfile, gradle, groovy, h, hpp, hxx, java, jenkinsfile,\n                            python, sh, shell\n  -r, --recursive           If FILES includes directories, process their contents recursively.\n  --debug                   Debug mode: Preview the result of an action without modifying files.\n  --verbose                 Show a detailed processing summary.\n  --completion              Print the bash completion script to stdout.\n  --install-completion      Install bash completion to the OS-appropriate directory (auto-detected, no\n                            root needed by default).\n  -h, --help                Show this help message and exit.\n  -v, --version             Show program's version number and exit.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarslo%2Fcr-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarslo%2Fcr-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarslo%2Fcr-manager/lists"}