Syntax highlighting of munki pkginfo files

Do you ever fire up TextWrangler and open a pkginfo file used in munki to adjust or add a key but when you go to actually add that key you can’t remember the exact format of the syntax?  Was it “update_for” or “update-for”?  It kinda matters.  Lucky for us there is a syntax highlighting feature in TextWrangler (and BBEdit) that allows for customization called Language Modules.

I’ve created a munki Language Module, available on github,  that lets you breath a little easier in knowing your syntax typo is not the reason munki is looping…that’s something else you’ve done.

Using the Language Module is fairly easy.  To install:

  1. Download and copy the munki_langauage_module.plist to ~/Library/Application Support/TextWrangler/Language Modules/
  2. Restart TextWrangler.
  3. Adjust keyword and predefined syntax highlighting colors in the TextWrangler preferences if you so choose.

This module sets TextWrangler to detect all files that end in .plist as munki pkgsinfo files.
If that is not desirable and you’d rather have standard XML highlighting, then remove the BBLMSuffixMap key from the plist or change the syntax highlight language when you open the file.

Inside TextWrangler you can manually choose the language syntax highlighting from the options at the bottom of the TextWrangler window. Choose “Munki Pkgsinfo” to apply the highlighting.  That’s it!

Below is an example of the difference between a syntax highlighted file on the left and a plain text file on the right.

side-by-side

Advertisements
Tagged ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: