Skip to content

Add set_license.py to keep licenses.yml in step with scheme changes - #892

Merged
mbadolato merged 1 commit into
mbadolato:masterfrom
zaccesss:add-license-tool
Oct 28, 2026
Merged

mbadolato merged 1 commit into
mbadolato:masterfrom
zaccesss:add-license-tool

Conversation

@zaccesss

Copy link
Copy Markdown
Contributor

Closes #891

This adds tools/set_license.py so a script that adds, renames or removes schemes (the daily sync from Terminal Themes) can update licenses.yml in the same run, instead of the check failing until someone edits the file by hand.

python3 tools/set_license.py set "Paper Crane" --license MIT --source https://terminalthemes.com/themes/paper-crane
python3 tools/set_license.py rename "Old Name" "New Name"
python3 tools/set_license.py remove "Old Name"
  • set adds an entry or replaces an existing one. The licence must be one check_licenses.py accepts (a listed SPDX identifier, unknown or nonfree) and the source must be a URL or empty. --note is optional.
  • The header comment and every other entry are written back byte for byte. New entries go in the same case-insensitive alphabetical order the file already uses.
  • Invalid input exits with 1 and leaves the file untouched.

For the sync, the change would be one set call per theme it adds, with the licence it already writes to the PR body and the theme's Terminal Themes page as the source, plus rename or remove when a theme changes name or goes away. Running python3 tools/check_licenses.py afterwards confirms nothing was missed.

Also in this PR:

  • tools/test_set_license.py: six tests, including one that splits and rejoins the real licenses.yml and checks it comes back unchanged.
  • The Check Scheme Licenses workflow runs the new tests and triggers on the two new files.
  • A short note under "Add a licence entry" in the README.

Locally python3 tools/check_licenses.py, both test files and a real set then remove on licenses.yml (which leaves the file identical) all pass.

@mbadolato
mbadolato merged commit 21e59c2 into mbadolato:master Oct 28, 2026
1 check passed
@mbadolato

Copy link
Copy Markdown
Owner

Thanks! The TT sync now includes the license yaml updates, too!

@zaccesss

Copy link
Copy Markdown
Contributor Author

@mbadolato Thank you for merging it. Great to hear the terminalthemes.com sync picks up the licence entries now too.

@zaccesss
zaccesss deleted the add-license-tool branch October 29, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep licenses.yml in step with the daily sync

2 participants