I'm looking for an easy way to add a shell variable to TextMates preferences via a shell script, I've got so far but the final step seems a little illusive.
The following just overwrites what's already there....
defaults write com.macromates.textmate OakShellVariables '{enabled = 1; value = "/Users/simon/classes"; variable = "CLASS_PATH"; }'
As the script would run as part of a bundle package install it would be possible to quit textmate first and not run the risk of defaults confusion, but ideally I'd like something similar that could simply be executed via a command.
Any help would be great.
Thanks, Simon
On 02/11/2005, at 14.48, Simon Gregory wrote:
I'm looking for an easy way to add a shell variable to TextMates preferences via a shell script, I've got so far but the final step seems a little illusive.
The following just overwrites what's already there....
You want to specify the value using '-array-add', e.g.:
defaults write com.macromates.textmate OakShellVariables \ -array-add '{enabled = 1; value = "/Users/simon/classes"; variable = "CLASS_PATH"; }'
As the script would run as part of a bundle package install it would be possible to quit textmate first and not run the risk of defaults confusion, but ideally I'd like something similar that could simply be executed via a command.
Unfortunately there's no way to have two applications “use” the defaults at the same time (w/o the risk of having one flush and overwrite changes done by the other).
On 02/11/2005, at 15.33, Allan Odgaard wrote:
You want to specify the value using '-array-add', e.g.: defaults write com.macromates.textmate OakShellVariables \ -array-add '{enabled = 1; value = "/Users/simon/classes"; variable = "CLASS_PATH"; }'
A word of warning: 'enabled' must be a boolean, and adding it like above adds it as an integer, which will make TextMate throw an exception when executing shell commands (until the entry is removed).
I'll make next build accept an integer as well.
Firstly, thanks Allan.
A word of warning: 'enabled' must be a boolean, and adding it like above adds it as an integer, which will make TextMate throw an exception when executing shell commands (until the entry is removed).
I'm assuming that I can't use
defaults write com.macromates.textmate OakShellVariables \ -array-add '{enabled = true; value = "/Users/simon/classes"; variable = "CLASS_PATH"; }'
as it'll be interpreted as a string...
I'll make next build accept an integer as well.
I've written a clunky shell script that reads in the shell variables and then only adds them if they not already there, so I'll be looking forward to this.
Cheers, Simon
On 02/11/2005, at 20.01, Simon Gregory wrote:
A word of warning: 'enabled' must be a boolean, and adding it like above adds it as an integer, which will make TextMate throw an exception when executing shell commands (until the entry is removed).
I'm assuming that I can't use defaults write com.macromates.textmate OakShellVariables \ -array-add '{enabled = true; value = "/Users/simon/classes"; variable = "CLASS_PATH"; }' as it'll be interpreted as a string...
Indeed -- not sure how one would provide type info for the individual values (when adding in batch). I guess the real problem is the old- style plist formats lack of a boolean type.
In retrospect, I should of course have made a “disabled” key instead, that way, just leaving it out would mean enabled.
I'll make next build accept an integer as well.
I've written a clunky shell script that reads in the shell variables and then only adds them if they not already there, so I'll be looking forward to this.
It unfortunately escaped todays build, but it'll be in the next one, for sure! :)