reuse-tool icon indicating copy to clipboard operation
reuse-tool copied to clipboard

Allow project-external templates for `addheader`

Open mxmehl opened this issue 3 years ago • 2 comments

Currently, it's only possible to refer to custom templates for addheader using templates that are within the project's .reuse/templates folder. See the current documentation here.

We want to make it possible to also load templates from other, more global places.

This could be:

  • The templates could be loaded from a user's config directory like ~/.config/reuse/templates/, also referred to then as reuse addheader --template="myglobaltemplate". To support different operating systems, the appdirs library could be used.
  • They could also be loaded from any path, e.g. reuse addheader --template="/my/reuse/templates" or reuse addheader --template="~/../templates"
  • In any case, we figured that if the value is not a path but just a name (e.g. --template="mytemplate"), that the tool should first look for .reuse/templates/mytemplate.jinja2 and only if nothing is found in mytemplate (so a relative path on the same level).

mxmehl avatar Aug 31 '22 14:08 mxmehl

My personal expectation was that reuse would look in...

  1. the project's .reuse/templates/ folder
  2. the parent directories .reuse/templates/ folder (allowing for organization grouped working directories to share configs)
  3. my user directory space: ~/.reuse/templates/ (allowing use by me across all my projects)

It looks like appdirs could provide for the third option.

BigBlueHat avatar Feb 15 '24 18:02 BigBlueHat