From 66c82d40adaf464fedd834cea27f68c8b6b09048 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Jul 31 2011 13:30:29 +0000 Subject: Update `cli_printCopyrightInfo.sh:' - Stop processing arguments through getopt. Use positional parameters as they are provided. - Add `--copyright-holder-predicate' option. This option adds to copyright holder the `All rights reserved.' predicate. --- diff --git a/Scripts/Functions/cli_printCopyrightInfo.sh b/Scripts/Functions/cli_printCopyrightInfo.sh index 851f321..cc6bf26 100755 --- a/Scripts/Functions/cli_printCopyrightInfo.sh +++ b/Scripts/Functions/cli_printCopyrightInfo.sh @@ -35,126 +35,84 @@ function cli_printCopyrightInfo { - # Define short options. - local ARGSL='' - - # Define long options. - local ARGSL='license,license-url,coyright,copyright-year,copyright-year-last,copyright-year-first,copyright-year-list,copyright-year-range,copyright-holder' - - # Initialize arguments with an empty value and set it as local - # variable to this function scope. - local ARGUMENTS='' - - # Redefine ARGUMENTS variable using current positional parameters. - cli_parseArgumentsReDef "$@" - - # Redefine ARGUMENTS variable using getopt output. - cli_parseArguments - - # Redefine positional parameters using ARGUMENTS variable. - eval set -- "$ARGUMENTS" - - # Look for options passed through positional parameters. - while true; do - - case "$1" in - - --license ) - - # Print out the name of the license used by to release - # the content produced by centos-art.sh script, inside - # CentOS Artwork Repository. - echo "Creative Common Attribution-ShareAlike 3.0" - shift 2 - break - ;; - - --license-url ) - - # Print out the url of the license used by to release - # the content produced by centos-art.sh script, inside - # CentOS Artwork Repository. - cli_printUrl --cc-sharealike - shift 2 - break - ;; - - --copyright-year-first ) - - # The former year when I (as part of The CentOS - # Project) started to consolidate The CentOS Project - # Corporate Visual Identity through the CentOS Artwork - # Repository. - echo '2009' - shift 2 - break - ;; - - --copyright-year|--copyright-year-last ) - - # The last year when The CentOS Project stopped - # working in its Corporate Visual Identity through the - # CentOS Artwork Repository. That is something that I - # hope does never happen, so assume the current year - # as last working year. - date +%Y - shift 2 - break - ;; - - --copyright-year-range ) - - local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first') - local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last') - echo "${FIRST_YEAR}-${LAST_YEAR}" - shift 2 - break - ;; - - --copyright-year-list ) - - local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first') - local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last') - - # Define full copyright year string based on first and - # last year. - local FULL_YEAR=$(\ - while [[ ${FIRST_YEAR} -le ${LAST_YEAR} ]];do - echo -n "${FIRST_YEAR}, " - FIRST_YEAR=$(($FIRST_YEAR + 1)) - done) - - # Prepare full copyright year string and print it out. - echo "${FULL_YEAR}" | sed 's!, *$!!' - shift 2 - break - ;; + case "$1" in + + --license ) + + # Print out the name of the license used by to release the + # content produced by centos-art.sh script, inside CentOS + # Artwork Repository. + echo "`gettext "Creative Common Attribution-ShareAlike 3.0 License"`" + ;; + + --license-url ) + + # Print out the url of the license used by to release the + # content produced by centos-art.sh script, inside CentOS + # Artwork Repository. + cli_printUrl --cc-sharealike + ;; + + --copyright-year-first ) + + # The former year when I (as part of The CentOS Project) + # started to consolidate The CentOS Project Corporate + # Visual Identity through the CentOS Artwork Repository. + echo '2009' + ;; + + --copyright-year|--copyright-year-last ) + + # The last year when The CentOS Project stopped working in + # its Corporate Visual Identity through the CentOS Artwork + # Repository. That is something that I hope does never + # happen, so assume the current year as last working year. + date +%Y + ;; + + --copyright-year-range ) + + local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first') + local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last') + echo "${FIRST_YEAR}-${LAST_YEAR}" + ;; + + --copyright-year-list ) + + local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first') + local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last') + + # Define full copyright year string based on first and + # last year. + local FULL_YEAR=$(\ + while [[ ${FIRST_YEAR} -le ${LAST_YEAR} ]];do + echo -n "${FIRST_YEAR}, " + FIRST_YEAR=$(($FIRST_YEAR + 1)) + done) + + # Prepare full copyright year string and print it out. + echo "${FULL_YEAR}" | sed 's!, *$!!' + ;; - --copyright-holder ) + --copyright-holder ) - # Output default copyright holder. - echo "The CentOS Artwork SIG" - shift 2 - break - ;; - - --copyright ) - - local YEAR=$(cli_printCopyrightInfo '--copyright-year-last') - local HOLDER=$(cli_printCopyrightInfo '--copyright-holder') - echo "Copyright © $YEAR $HOLDER" - shift 2 - break - ;; - - -- ) - cli_printMessage "`gettext "At least one option is required."`" --as-error-line - shift 1 - break - ;; - - esac - - done + # Output default copyright holder. + echo "`gettext "The CentOS Project"`" + ;; + + --copyright-holder-predicate ) + + local HOLDER=$(cli_printCopyrightInfo '--copyright-holder') + echo "${HOLDER}. `gettext "All rights reserved."`" + ;; + + --copyright ) + + local YEAR=$(cli_printCopyrightInfo '--copyright-year-last') + local HOLDER=$(cli_printCopyrightInfo '--copyright-holder') + echo "Copyright © ${YEAR} ${HOLDER}" + ;; + + esac }