Search Ali's Blog

Monday, September 20, 2010

Script Header Generator

If you write a lot of scripts, you are aware of the importance of the scripts headers.
General, script header define the script language, usage, description, author..

I wrote this script, that generates a script header based on the template below, the script tries to identify the script language and usage automatically, in addition to some other fields, variables that need to be set manually are marked with "TBD" such as script description.

Feel free to change the AUTHOR and AUTHOR_EMAIL in the script to your own strings.
I found this scripts very useful to fix the header of hundreds of scripts I have that didn't include the appropriate header. Share and Enjoy.


Example, to generate the header of the script test.py, run:
$ ./create_header.py test.py

#!/usr/bin/env python

#===========================================
#
# FILE: test.py
# USAGE: ./test.py [--help|--version]
# DESCRIPTION: Tests how fast you can type A-Z
# REQUIREMENTS: python, finger
# BUGS: N/A
# NOTES: Dummy File
# AUTHOR: Ali Ayoub
# EMAIL: ali@ali.ali
# COMPANY: LIUB, Ltd.
# CREATED: 09.19.2010-19:05:39
# REVISION: 1.2
#===========================================

Tip:
Python Rocks.

No comments: