Created
December 13, 2016 07:34
-
-
Save watr/4f570615ac802e18b676b2a47868b195 to your computer and use it in GitHub Desktop.
print .xib files which using auto layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## usase: $ sh ./find-xib-use-autolayout.sh <path_to_search_directoty> | |
path_to_search_directoty="$1" | |
cd "$path_to_search_directoty" | |
function document_uses_autolayout () { | |
# $1: file path | |
matched_text=`grep -H -i -e 'useAutolayout="YES"' -e 'key="IBDocument.UseAutolayout">YES' "$1"` | |
if [ $? -eq 0 ]; then # if matched | |
return 0 # successful result | |
else | |
return 1 # unsuccessful result | |
fi | |
} | |
export -f document_uses_autolayout | |
function print_autolayout_setting () { | |
document_uses_autolayout "$1" | |
if [ $? -eq 0 ]; then | |
result="->AutoLayout " | |
else | |
result=" NOT AutoLayout" | |
fi | |
echo " " "$result": "$1" | |
} | |
export -f print_autolayout_setting | |
find . -name "*.xib" -print0 | xargs -0 -I {} bash -c "print_autolayout_setting {}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment