开发者

How to set a boolean value in an array object in a plist

I'm trying to modify my settings for Textmate by modifying its plist. Here's what I've got so far:

defaults write com.macromates.textmate OakShellVariables -array-add '{value = "hello"; variable = "TM_HELLO";}'

This will add in a new shell variable for Textmate.开发者_如何学Python I'm wanting to do this via the command line so that I can script it. The above works fine but I also want to set the enabled key (which is a boolean) to true. Unfortunately, I can't seem to figure out the correct syntax to achieve this. All my attempts result in setting the enabled key to be a string instead of a boolean. For example:

defaults write com.macromates.textmate OakShellVariables -array-add '{enabled = true ;value = "hello"; variable = "TM_HELLO";}


This is how you do it Michael. I was looking for the same thing, and I happened to come across the answer. Thought I'd share. Example shown below.

defaults write com.apple.dashboard layer-gadgets -array-add "<dict><key>32bit</key><false/></dict>";

These are the data types:

  • <string></string> - string
  • <false/><true/> - boolean
  • <real></real> - real
  • <integer></integer> - integer
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜