https://github.com/harish2704/file-header
A template based commandline file-header generator
https://github.com/harish2704/file-header
file-header header nodejs tempalte vim vim-plugin
Last synced: 3 months ago
JSON representation
A template based commandline file-header generator
- Host: GitHub
- URL: https://github.com/harish2704/file-header
- Owner: harish2704
- License: mit
- Created: 2016-12-02T19:20:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-26T11:59:43.000Z (about 8 years ago)
- Last Synced: 2025-02-19T19:04:34.677Z (3 months ago)
- Topics: file-header, header, nodejs, tempalte, vim, vim-plugin
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# file-header
A CLI tool for generating file header from a configuration file and an EJS template.## Installation
#### install the package
`npm i -g file-header`#### Edit the config file ( Optional )
Data to be presented on a file header is stored in a config file which is located at `~/.file-headers/template_data.js`The default content of this file will be as follows.
```javascript
module.exports = {
user: process.env.USER,
email: process.env.USER + '@' + process.env.HOST,
date: new Date(),
};```
We can customize it as required. For example, change it to
```javascript
module.exports = {
user: 'Jake sully'
email: '[email protected]'
github: 'https://github.com/jakesully'
date: new Date(),
};
```#### Edit the [EJS](ejs) tempalte of the default file-header ( Optional )
The default file header template can be found at `~/.file-headers/default`
It is just [EJS](ejs) template. We can customize it to any extend.If we require different template for each file type , create a file `~/.file-headers/`
* For javscript, create a custom template at `~/.file-headers/js` and customize it.
* If we want a custom header for '*.spec.js' file, create ~/.file-headers/spec.js and customize it## Usage
Commandline
```
file-header
```
which will print the file header to your console.#### Use with Vim editor
Add the below line to your vim config file
```vim
command! Header :execute '0r!file-header %'
```Now, type `:Header` to add file header to your current buffer.
[ejs]: https://github.com/mde/ejs "Ejs template engine"