GithubHelp home page GithubHelp logo

amitibo / licenseheaders Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johann-petrak/licenseheaders

0.0 2.0 0.0 16 KB

Simple python script to add/replace license headers in a directory tree of source files

License: Other

Python 100.00%

licenseheaders's Introduction

PyPi version Python compatibility Build Status PyPi Coverage Codacy

licenseheaders

A tool to update, change or add license headers to all files of any of the supported types in or below some directory.

Currently, the following file types are supported: Java/Scala/Groovy, bash/sh/csh, ...

Usage

usage: licenseheaders.py [-h] [-v] [-V] [-d directory] [-t template] [-y years] [-b] [-a]
                          [-c copyrightOwner]

License Header Updater

positional arguments: none

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -v, --verbose         increases log verbosity (can be specified multiple times)
  -d, --dir             directory to process, all subdirectories will be included
  -t, --tmpl            template name or file to use (if not specified, -y must be specified)
  -y, --years           if template is specified, the year to substitute, otherwise this year
                        or year range will replace any existing year in existing headers.
                        Replaces variable ${years} in a template
  -b, --backup          for each file that gets changed, create a backup of the original with
                        the additional filename extension .bak
  -c, --cr              copyright owner, replaces variable ${owner} in a template
  -a, --addonly         add a header to all supported file types, ignore any existing headers.

Examples:
# Add a new license header or replace any existing one based on the lgpl3 template.
# Process all files of supported type in or below the current directory.
# Use "Eager Hacker" as the copyright owner.
licenseheaders.py -t lgpl3 -c "Eager Hacker"

If licenseheaders is installed as a package (from pypi for instance), one can interact with it as a command line tool:

python -m licenseheaders -t lgpl3 -c "Eager Hacker"

Installation

Download licenseheaders.py from http://github.com/johann-petrak/licenseheaders or :

pip install licenseheaders

Template names and files

This library comes with a number of predefined templates. If a template name is specified which when matched against all predefined template names matches exactly one as a substring, then that template is used. Otherwise the name is expected to be the path of file.

If a template does not contain any variables of the form ${varname} it is used as is. Otherwise the program will try to replace the variable from one of the following sources:

  • an environment variable with the same name but the prefix LICENSE_HEADERS_ added
  • the command line option that can be used to set the variable (see usage)

Supported file types and how they are processed

Java: - assumed for all files with the extensions: .java, .scala, .groovy - only headers that use Java block comments are recognised as existing headers - the template text will be wrapped in block comments

License

Licensed under the term of MIT License. See attached file LICENSE.txt.

licenseheaders's People

Contributors

johann-petrak avatar

Watchers

Amit Aides avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.