Skip to content

Instantly share code, notes, and snippets.

@juanarzola
Created December 19, 2010 16:39
Show Gist options
  • Save juanarzola/747464 to your computer and use it in GitHub Desktop.
Save juanarzola/747464 to your computer and use it in GitHub Desktop.
Generate a switch statement from a selection of #define statements. This is intended to be used within Xcode user scripts. (Make sure that "directory" is set to "home")
#!/bin/sh
echo "switch(<#expression#>){"
echo -n "%%%{PBXSelection}%%%"
awk '/#define/ {print " case "$2":{\n break;\n }"}' <&0
echo -n "%%%{PBXSelection}%%%"
echo "}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment