Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

macos

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. 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";}
like image 631
Michael MacDonald Avatar asked Nov 16 '10 11:11

Michael MacDonald


1 Answers

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
like image 60
xxyy Avatar answered Sep 20 '22 04:09

xxyy