How to use the command mh_copyright (with examples)
This article explains how to use the mh_copyright
command with examples.
Command Description:
The mh_copyright
command is used to adjust copyright headers for MATLAB or Octave code. It is a tool provided by the Missh IT organization. It allows you to update the year (range) in the copyright headers of the specified MATLAB or Octave files to include the current year.
Use case 1: Updating the year (range) for specified files.
Code:
mh_copyright --primary-entity="entity" --update-year path/to/file_or_directory1.m path/to/file_or_directory2.m ...
Motivation:
When you want to update the year (range) in the copyright headers of specific MATLAB or Octave files to include the current year, you can use this command. This is useful when you have made modifications or additions to certain files in your project and want to ensure that the copyright information is up to date.
Explanation:
--primary-entity
: It specifies the primary entity or organization that holds the copyright. This information will be used to update the copyright headers.--update-year
: This flag instructs the command to update the year (range) in the copyright headers to include the current year.path/to/file_or_directory1.m path/to/file_or_directory2.m ...
: These are the paths to the MATLAB or Octave files or directories that you want to update the copyright headers for.
Example output:
Successfully updated copyright header in path/to/file1.m.
Successfully updated copyright header in path/to/file2.m.
Use case 2: Updating the year (range) for all files.
Code:
mh_copyright --primary-entity="entity" --update-year
Motivation:
Sometimes, you may want to update the year (range) in the copyright headers of all the MATLAB or Octave files in your project. This ensures that all files have accurate and up-to-date copyright information.
Explanation:
--primary-entity
: It specifies the primary entity or organization that holds the copyright. This information will be used to update the copyright headers.--update-year
: This flag instructs the command to update the year (range) in the copyright headers to include the current year.
Example output:
Successfully updated copyright header in path/to/file1.m.
Successfully updated copyright header in path/to/file2.m.
Successfully updated copyright header in path/to/file3.m.
...
Conclusion:
The mh_copyright
command is a useful tool for updating the year (range) in copyright headers for MATLAB or Octave files. Whether you want to update specific files or update all the files in your project, this command provides an easy and efficient way to ensure that the copyright information is accurate and up-to-date.