From 9ed37be565fb51dc3dec80946e49ae9f36c41f5c Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 1 Feb 2016 06:24:30 +0100 Subject: Merge the tca_file sed commands into one command stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now we've only one sed invocation per file – that rocks! --- add_extbase_property.sh | 28 ++++++++++++---------------- 1 file 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 -- cgit