Skip to content

fwolf/copyright-year-updater.sh

Repository files navigation

Copyright Year Updater

Build Status

Automatic update year in copyright notice, follow GNU Suggestion.

Usage

copyright-year-updater.sh [Options] [File]

Options

-y, --year              Copyright end year, default is current year

All options must set before [File].

Multiple files

Currently can only update single file, but we can use find and xargs to treat multiple files:

find *.sh | xargs -L1 copyright-year-updater.sh

Git pre-commit hook

Copy pre-commit.sample.sh as .git/hooks/pre-commit, chmod +x.

This hook will not touch un-staged file, even this file have staged part.

Notice for usage in MacOS X

MacOS X uses BSD version command utils, so you need GNU versons:

  • Bash v4
  • grep
  • sed
  • xargs

You can install them via brew and configure to use them, here is some useful links:

Brew by default install grep, sed, xargs with prefixed with g, like ggrep, to overwrite system grep:

  • In /usr/local/bin/, ln ggrep to grep, so do gsed and xargs
  • Config PATH, put /usr/local/bin/ before /usr/bin/ or $PATH
  • Restart bash

License

MIT

About

Automatic update year in copyright notice

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages