Logo

index : cp-license

---

  • summary
  • about
  • tree
  • log
  • branches
https://git.ptrace.dev/public/cp-license.git
ssh://git@git.ptrace.dev/public/cp-license.git
PY: 50%
MD: 50%

Copy License

Copies software licenses into your project. Optionally, it also adds the short variant of the license into your main file.

Usage

Create license in directory

./cp-license.py [license short name] [destination directory] [author] [date]

Consult the help menu for all options and more information:
./cp-license.py h

Add license into your file

./cp-license pre [license short name] [author] [date] [language] [source file]

More information about the prepend-mode:
./cp-license.py h pre

Examples

Add a license to your project:
./cp-license.py mit ~/foo/bar/my_project_dir

Some licenses have a "author" & "year" placeholder. You can populate them directly:
./cp-license.py mit ~/foo/bar/my_project_dir Peter 2025

You can omit the date 2025 and it will use the current year.

Add a short variant of the license into your main file:
./cp-license.py pre gpl3 Peter 2025 c src/main.c

If you replace 2025 with 0, it will use the current year.

You can also omit the author and date:
./cp-license.py pre gpl3 c src/main.c

Notes on pre, prepend

  • it will always create a backup of your file, before writing into it.
  • if a backup exists, it does not overwrite the backup
  • if a shebang #! and/or editor mode -*- exists, it will append the license text below it

Add a new license

Please consult cp-license.py and look for the docstring # How to add a new license.

Add a new language comment token

Consult cp-license.py and look for # How to add a new language comment token

EXPAND COLLAPSE
Name
Size
Modified (UTC)
LICENSE
2 kB
2025-10-13
raw
README.md
2 kB
2025-10-13
raw
cp-license.py
20 kB
2025-11-30
raw
---
---
Apache_License_v2_0
12 kB
2025-10-13
raw
BSD_3_CLAUSE
2 kB
2025-11-30
raw
Boost_Software_License_v_1_0
2 kB
2025-10-13
raw
GNU_AGPL_v3
34 kB
2025-10-13
raw
GNU_GPL_v3
35 kB
2025-10-13
raw
GNU_LGPL_v3
8 kB
2025-10-13
raw
MIT_License
2 kB
2025-10-13
raw
Public_Domain_CC0_1_0
151 b
2025-10-14
raw
The_Unlicense
2 kB
2025-10-13
raw
---
---
Apache_License_v2_0
567 b
2025-10-13
raw
GNU_AGPL_v3
746 b
2025-10-13
raw
GNU_GPL_v3
725 b
2025-10-13
raw
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit