Skip to content

Instantly share code, notes, and snippets.

@kylef
Created March 30, 2011 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylef/895068 to your computer and use it in GitHub Desktop.
Save kylef/895068 to your computer and use it in GitHub Desktop.
Template generator for a znc module
#!/bin/sh
# Usage: ./modgen.sh CFooMod > foo.cpp
# Usage: ./modgen.sh CFooMod global > foo.cpp
if [ ! "$1" ]; then
echo "No module class name supplied"
exit 1
fi
classname=$1
superclass=CModule
description="Insert description here"
modcontructor=MODCONSTRUCTOR
moddef=MODULEDEFS
if [ "$2" ]; then
superclass=CGlobalMod
modcontructor=MODCONSTRUCTOR
moddef=GLOBALMODULEDEFS
fi
echo "/*
* Copyright (C) 2004-2011 See the AUTHORS file for details.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include \"Modules.h\"
class $classname : public $superclass
public:
$modcontructor($classname) {}
virtual ~$classname() {}
};
$moddef($classname, \"$description\")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment