From 33654163eee70504e767cb47120bb7b1ffc63190 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 3 Oct 2012 00:35:25 +0000 Subject: [PATCH] Code cleanup (avoiding switch statements within switch statements) --- src/deforaos-package.sh | 91 ++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 41 deletions(-) diff --git a/src/deforaos-package.sh b/src/deforaos-package.sh index 770abca..df94192 100755 --- a/src/deforaos-package.sh +++ b/src/deforaos-package.sh @@ -338,55 +338,64 @@ _debian_menu() while read line; do name="${line%%=*}" value="${line#*=}" + + #determine the most essential values case "$name" in Categories) - case "$value" in - *Accessibility*) - section="Applications/Accessibility" - ;; - *Player*) - section="Applications/Video" - ;; - *Audio*|*Mixer*) - section="Applications/Sound" - ;; - *ContactManagement*) - section="Applications/Data Management" - ;; - *Development*) - section="Applications/Programming" - ;; - *Documentation*) - section="Help" - ;; - *Email*|*Telephony*) - section="Applications/Network/Communication" - ;; - *FileManager*) - section="Applications/File Management" - ;; - *Viewer*) - section="Applications/Viewers" - ;; - *Office*) - section="Applications/Office" - ;; - *Settings*) - section="Applications/System/Administration" - ;; - *TextEditor*) - section="Applications/Editors" - ;; - *WebBrowser*) - section="Applications/Network/Web Browsing" - ;; - esac ;; Exec) command="/usr/bin/$value" + continue ;; Name) title="$value" + continue + ;; + *) + continue + ;; + esac + + #determine the section + case "$value" in + *Accessibility*) + section="Applications/Accessibility" + ;; + *Player*) + section="Applications/Video" + ;; + *Audio*|*Mixer*) + section="Applications/Sound" + ;; + *ContactManagement*) + section="Applications/Data Management" + ;; + *Development*) + section="Applications/Programming" + ;; + *Documentation*) + section="Help" + ;; + *Email*|*Telephony*) + section="Applications/Network/Communication" + ;; + *FileManager*) + section="Applications/File Management" + ;; + *Viewer*) + section="Applications/Viewers" + ;; + *Office*) + section="Applications/Office" + ;; + *Settings*) + section="Applications/System/Administration" + ;; + *TextEditor*) + section="Applications/Editors" + ;; + *WebBrowser*) + section="Applications/Network/Web Browsing" ;; esac done < "data/$i.desktop"