Blame Scripts/Bash/Functions/cli_getThemeName.sh

4c79b5
#!/bin/bash
4c79b5
#
4c79b5
# cli_getThemeName.sh -- This function manipulates the current
4c79b5
# absolute path to extract the theme name from it. If there is no
4c79b5
# theme in the path, this function returns an empty string.
4c79b5
#
4c79b5
# Copyright (C) 2009-2010 Alain Reguera Delgado
4c79b5
# 
4c79b5
# This program is free software; you can redistribute it and/or
4c79b5
# modify it under the terms of the GNU General Public License as
4c79b5
# published by the Free Software Foundation; either version 2 of the
4c79b5
# License, or (at your option) any later version.
4c79b5
# 
4c79b5
# This program is distributed in the hope that it will be useful, but
4c79b5
# WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
4c79b5
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4c79b5
# USA.
4c79b5
# 
4c79b5
# ----------------------------------------------------------------------
4c79b5
# $Id: cli_getThemeName.sh 77 2010-09-18 06:01:51Z al $
4c79b5
# ----------------------------------------------------------------------
4c79b5
4c79b5
function cli_getThemeName {
4c79b5
4c79b5
    local THEMENAME=''
4c79b5
4c79b5
    if [[ $OPTIONVAL =~ '^.+/Themes/Motifs/([A-Za-z0-9-]+)+/.+$' ]];then
4c79b5
        THEMENAME=$(echo $OPTIONVAL \
4c79b5
            | sed -r 's!^.+/Themes/Motifs/([A-Za-z0-9-]+)+/.+!\1!') 
4c79b5
    fi
4c79b5
4c79b5
    echo $THEMENAME
4c79b5
}