pre-commit-hooks icon indicating copy to clipboard operation
pre-commit-hooks copied to clipboard

Is there a way of defining a string in the hooks args instead of --license-filepath

Open mikel-brostrom opened this issue 1 year ago • 2 comments

This:

- repo: https://github.com/Lucas-C/pre-commit-hooks
  rev: v1.5.3
  hooks:
    - id: insert-license
      files: ./*
      args:
        - --license-filepath
        - LICENSE
        - --use-current-year

does not work for me as my LICENSE 600+ lines long and I don't want to add a txt file to the repo simply for this. Is there a way of specifying a string to be inserted? Something like

- repo: https://github.com/Lucas-C/pre-commit-hooks
  rev: v1.5.3
  hooks:
    - id: insert-license
      files: ./*
      args:
        - --license-string
        - "MyName RepoName AGPL3.0 License"
        - --use-current-year

?

mikel-brostrom avatar Aug 05 '23 19:08 mikel-brostrom

Hi @mikel-brostrom

No, currently this hook does not offer such feature, but you are welcome to contribute such new option through a Pull Request with some unit tests 😊

Lucas-C avatar Aug 11 '23 18:08 Lucas-C

See https://github.com/johannsdg/pre-commit-license-headers for an example with a multi-line license defined in the pre-commit YAML file.

peterjc avatar Aug 29 '24 13:08 peterjc