[TxMt] Shell Variables and templates
Prachi Gauriar
pgauriar at mac.com
Mon Jun 5 05:36:09 UTC 2006
Hi everyone. I just started using TextMate today and I've run into a
little problem. I've noticed that my Shell Variables (as set in the
Preferences) aren't loaded properly when I use templates. For
example, I'd kind of like to mimic Xcode's built-in templates. To do
this, I've modified the Java Class template to look more like:
//
// ${TM_NEW_FILE_BASENAME}.java
//
// Created by ${TM_USERNAME} on ${TM_DATE}.
// Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights
reserved.
//
...
and I've updated the script associated with that template to look
like this:
export TM_YEAR=`date +%Y`
export TM_DATE=`python -c 'import datetime
now = datetime.datetime.now()
print "%s/%s/%s" % (now.day, now.month, now.year)
'`
export TM_USERNAME=`niutil -readprop / /users/\$USER realname`
perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \
< class-insert.java > "$TM_NEW_FILE"
All of this works fine, except ${TM_ORGANIZATION_NAME} isn't being
replaced correctly. It works fine for Code Snippets, but not in
Templates. If I add
env >> "$TM_NEW_FILE"
to the end of the script, TM_ORGANIZATION_NAME isn't listed. Is this
a bug or a known issue? I've searched Google, TextMate's bug list,
and the list archives, but I can't find any mention of the issue. I
would appreciate any help in resolving the problem... it's a minor
nuisance to an otherwise great application.
-Prachi
More information about the textmate
mailing list