Skip to content

Instantly share code, notes, and snippets.

@peisenhower
Created January 21, 2015 19:07
Show Gist options
  • Save peisenhower/7da11d8daec28fbd54d3 to your computer and use it in GitHub Desktop.
Save peisenhower/7da11d8daec28fbd54d3 to your computer and use it in GitHub Desktop.
C header template with doxygen
/**
* @file [file name].h
* @authors [Author]
* @copyright [Copyright holder]
*
* @brief [description]
*/
#pragma once
@raleighlittles
Copy link

raleighlittles commented Jun 20, 2023

I have this simple script for generating a Doxygen header that I use. You can modify it to add the copyright fields.

#!/bin/bash

set -e

input_file=$1
todays_date=$(date "+%Y-%m-%d")
git_user_email=$(git config --list | grep user.email | cut -f2 -d"=")
git_user_name=$(git config --list | grep user.name | cut -f2 -d"=")
filename=$(basename -- $input_file)

echo "/**"
echo "* @file $filename"
echo "* @date $todays_date"
echo "* @author $git_user_name <$git_user_email>"
echo "* @brief "
echo "*/"

It uses your Git config setup to grab your name and email address. You run it like:

$ ./generate_doxygen_header.sh misc-devel/parse_git_externals_into_chrome_bookmarks.py

and it returns:

/**
* @file parse_git_externals_into_chrome_bookmarks.py
* @date 2023-06-20
* @author Littles, Raleigh <raleigh.littles@domain-redacted.com>
* @brief 
*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment