6 $0 [-f] <name>.<ext> [<author>]
7 $0 [-f] SConscript [<author>]
9 Will add the file with that name to the current directory by copying
10 the appropriate template and replacing the @NAME@ placeholders
13 <ext> needs to be one of
17 cc non-inline non-template code
18 cci inline non-template code
19 ct non-inline template code
20 cti inline template code
21 mpp special Boost.Preprocessor sourcefile (external iteration)
22 dox additional doxygen documentation file
24 If <author> is given, it is also set correctly replaced. If <author>
25 is unset but the environment variable SENF_AUTHOR is set, it's value
26 is used. Otherwise, the @AUTHOR@ placeholder will need to be replaced
29 $0 will refrain from overwriting existing files except when the '-f'
35 base="`dirname "$0"`"; base="`cd "$base/_templates"; pwd`"
37 if [ "$1" == "-f" ]; then
42 name="`basename "$1"`"
44 *.*) type=".${name#*.}"; name="${name%.$type}" ;;
48 if [ ! -r "$base/Example$type" ] ; then
49 echo "Don't know about file type '$type'"
53 [ -z "$2" ] || SENF_AUTHOR="$2"
55 if [ -z "$force" -a -r "$1" ] ; then
56 echo "Target file '$1' exists."
60 sed -e "s/@NAME@/$name/g" -e "s/@AUTHOR@/${SENF_AUTHOR:-@AUTHOR@}/g" \
61 < "$base/Example$type" \
65 svn propset svn:keywords "Author Date Id Revision" "$1"