Skip to content

Commit

Permalink
bee-init: change commandline syntax: add -o <bee-file>[.bee]
Browse files Browse the repository at this point in the history
specify bee-file name with commandline option --output (-o)

this fixes several issues when setting the name of the bee-file.

no naming-convention checking is done yet.
  • Loading branch information
mariux committed Mar 23, 2012
1 parent cc9c507 commit 13484a1
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/bee-init.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function usage() {
Max Planck Institute for Molecular Genetics Berlin Dahlem
bee [bee-options] init [options] <url>
bee [bee-options] init [options] <pkgname> [url]
Options:
--configure=MODE set configure mode:
Expand All @@ -57,6 +56,7 @@ function usage() {
-V --version print version number.
-D --define=A=B define ENV variables with the bee-file.
(extra (over)quoting may be needed if B contains spaces.)
-o --output=bee-file name of new bee-file
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
Expand Down Expand Up @@ -151,23 +151,15 @@ function create_beefile_from_template {
}

function initialize() {
# get arguments starting with '--'
while [ -n "${1}" ] ; do
if [ "${1:0:2}" == "--" ] ; then
DEFAULT_CONFIGURE_OPTIONS="${DEFAULT_CONFIGURE_OPTIONS:+${DEFAULT_CONFIGURE_OPTIONS} }${1}"
else
PP="${PP:+${PP} }${1}"
fi
shift
done
surl=${1}

shift

pname=${OPT_OUTPUT}

# set positional parameters to arguments not starting with '--'
set -- ${PP}
pname=$1
surl=$2
DEFAULT_CONFIGURE_OPTIONS="${@}"

if [ -z "${surl}" ] ; then
surl=${pname}
if [ -z "${pname}" ] ; then

# fix sourceforge urls for automatic pkgname generation
if [[ $surl = *://sourceforge.net/*/files/*/download ]] ; then
Expand All @@ -182,8 +174,6 @@ function initialize() {

# strip /download basename
surl=${surl%/download}

pname=${surl}
fi

# start auto packagename generation with surl basename
Expand Down Expand Up @@ -277,6 +267,7 @@ options=$(${BEE_BINDIR}/beegetopt --name bee-init \
--option disable-versionify \
--option help/h \
--option version/V \
--option output/o= \
--option define/D= \
--option template/t= \
--option force/f \
Expand Down Expand Up @@ -306,6 +297,7 @@ if [ $? != 0 ] ; then
fi

OPT_VERSIONIFY="yes"
OPT_OUTPUT=

eval set -- "${options}"

Expand Down Expand Up @@ -369,6 +361,11 @@ while true ; do
shift 2
;;

--output)
OPT_OUTPUT=${2}
shift 2
;;

--define)
OPT_DEFINE="${OPT_DEFINE}\n${2}"
shift 2
Expand Down

0 comments on commit 13484a1

Please sign in to comment.