diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2016-02-01 06:24:30 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2016-02-01 06:24:30 +0100 |
commit | 9ed37be565fb51dc3dec80946e49ae9f36c41f5c (patch) | |
tree | 69752a115d7f94ea5d4217fca271d9b6f49d7295 | |
parent | 763729d0c615d8d244695780bac5bdeb0f3f2c3d (diff) | |
download | extbase-generator-cli-9ed37be565fb51dc3dec80946e49ae9f36c41f5c.tar.gz extbase-generator-cli-9ed37be565fb51dc3dec80946e49ae9f36c41f5c.tar.bz2 extbase-generator-cli-9ed37be565fb51dc3dec80946e49ae9f36c41f5c.zip |
Merge the tca_file sed commands into one command stream
Now we've only one sed invocation per file – that rocks!
-rwxr-xr-x | add_extbase_property.sh | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/add_extbase_property.sh b/add_extbase_property.sh index 324f555..6146b14 100755 --- a/add_extbase_property.sh +++ b/add_extbase_property.sh @@ -180,24 +180,20 @@ sql_type="${sql_types["$typ"]}" # TCA -# The first sed command is a fix for extension_builder's trailing comma in searchFields -sed -i \ - -e "s/\('searchFields' => .*\),',/\1',/" \ - -e "s/\('searchFields.*\)',\$/\1,$field',/" \ - -e "s/\('searchFields' => '\),\(.*\)/\1\2/" \ - -e "s/\('showRecordFieldList.*\)',\$/\1, $field',/" \ - -e "s/'label' => 'uid'/'label' => '${field}'/" \ - $tca_file - -# Place before the access tab, if that is available -if grep --quiet -- '--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access' $tca_file; then - sed -i "s/\('showitem' => '..*\)--div/\1$field, --div/" $tca_file -else - sed -i "s/\('showitem' => '..*\)'),/\1, $field'),/" $tca_file -fi +sed -i -f - $tca_file << EOF +s/\('searchFields' => .*\),',/\1',/ +s/\('searchFields.*\)',\$/\1,$field',/ +s/\('searchFields' => '\),\(.*\)/\1\2/ +s/\('showRecordFieldList.*\)',\$/\1, $field',/ +s/'label' => 'uid'/'label' => '${field}'/ + +/'showitem' =>/ { + # Place before the first tab, if that is available + /--div--/s/\('showitem' => '..*\)--div/\1$field, --div/ + /--div--/!s/\('showitem' => '..*\)'),/\1, $field'),/ +} -sed -i -f - $tca_file << EOF /[ ]*'columns' =>/ { :loop |