| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function cli_getRepoTLDir { |
| |
| |
| local ARGSS='r' |
| |
| |
| local ARGSL='relative' |
| |
| |
| |
| local ARGUMENTS='' |
| |
| |
| local PATTERN='' |
| local REPLACE='' |
| |
| |
| cli_parseArgumentsReDef "$@" |
| |
| |
| cli_parseArguments |
| |
| |
| eval set -- "$ARGUMENTS" |
| |
| |
| local LOCATION=$(echo $@ | sed -r 's!^.*--[[:space:]](.+)$!\1!') |
| |
| |
| |
| |
| if [[ $LOCATION =~ '--$' ]];then |
| LOCATION=${HOME}/artwork/trunk |
| fi |
| |
| |
| |
| |
| |
| |
| if [[ ! $LOCATION =~ "^${HOME}/artwork/(trunk|branches|tags)" ]];then |
| cli_printMessage "`eval_gettext "The location \\\"\\\$LOCATION\\\" is not valid."`" --as-error-line |
| fi |
| |
| # Look for options passed through positional parameters. |
| while true;do |
| |
| case "$1" in |
| |
| -r|--relative ) |
| PATTERN="^${HOME}/artwork/(trunk|branches|tags)/.+$" |
| REPLACE='\1' |
| shift 2 |
| break |
| ;; |
| |
| -- ) |
| PATTERN="^(${HOME}/artwork/(trunk|branches|tags))/.+$" |
| REPLACE='\1' |
| shift 1 |
| break |
| ;; |
| esac |
| |
| done |
| |
| # Print out top level directory. |
| echo $LOCATION | sed -r "s!${PATTERN}!${REPLACE}!g" |
| |
| } |
| |