nostalgia/scripts/newcpp

16 lines
357 B
Python
Executable File

#! /usr/bin/env python
import sys
if len(sys.argv) < 3:
sys.exit(1)
pkg = sys.argv[1]
name = sys.argv[2]
namespace = "namespace nostalgia {\nnamespace %s {\n\n}\n}" % pkg
hpp = "#pragma once\n"
cpp = "#include \"%s.hpp\"\n\n%s" % (name, namespace)
open("src/%s/%s.hpp" % (pkg, name), "w").write(hpp)
open("src/%s/%s.cpp" % (pkg, name), "w").write(cpp)