Skip to content

A node.js application that can be used to quickly update file headers.

License

Notifications You must be signed in to change notification settings

waltertamboer/fileheader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fileheader

Master: Build Status

A node.js application that can be used to quickly update file headers. If no file header exists yet, it's added and if there is a fileheader already, it is updated.

Install

To install fileheader use npm:

npm install -g fileheader

Usage

fileheader expects a configuration file called fileheader.json. The content of the document looks as follow:

{
	"template": [
		"/**",
		" * This is a template",
		" * ",
		" * @author Walter Tamboer",
		" */",
		"",
		""
	],
	"extensions": [".cpp", ".hpp", ".inl", ".php", ".my"],
	"ignore": [
		"\\.git$",
		"\\.svn$"
	],
	"variables": {
		"name": "Walter",
		"surname": "Tamboer"
	}
}

The template

The template member is used to define the header that should be at the top of the file. This array is joined with an new line character (\n). This template can contain variables, more about variables later on.

Extensions

The extensions member is used to filter the files that should be updated with a fileheader. As can be seen in the example, this is an array with strings representing the extensions.

Ignoring files and directories

To speed up iterating through your project it might be wise to skip certain directories or files. Use the ignore member to specify a list with regular expressions that match the files and directories that should be ignored.

Variables

The variables property can be used to define variables. These variables can be used in your template like this: $(variablename). A variable name can contain alphanumeric characters, underscores and dots. Next to custom variables there is a list with variables that fileheader provides. Here is an overview:

Variable Description
$(cwd) The current working directory.
$(date.full) The current date and time in an extended format.
$(date.utc) The current date and time in UTC format.
$(date.yyyy) The current year.
$(date.yy) The current year in a short notation.
$(date.mm) The current month with a leading zero.
$(date.m) The current month without a leading zero.
$(date.dd) The current day with a leading zero.
$(date.d) The current day without a leading zero.
$(date.dayofweek) The current day of the week. This is a value between zero and six.
$(date.hh) The current hour with a leading zero.
$(date.h) The current hour without a leading zero.
$(date.ii) The current minute with a leading zero.
$(date.i) The current minute without a leading zero.
$(date.ss) The current second with a leading zero.
$(date.s) The current second without a leading zero.
$(file.abspath) The absolute path of the file that is parsed.
$(file.basename) The base name of the file that is parsed. This is excluding the extension.
$(file.ext) The extension of the file that is parsed.
$(file.name) The name of the file that is parsed. This is including the extension.
$(file.relpath) The relative path of the file that is parsed.
$(os.hostname) The hostname of the system.
$(os.platform) The platform of the system.
$(os.type) The OS type of the system.
$(os.arch) The processor architecture of the system.
$(os.uptime) The uptime of the system.

About

A node.js application that can be used to quickly update file headers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published