Skip to content
Permalink
e77f32591d
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
80 lines (72 sloc) 1.76 KB
#!/bin/bash
#
# content2filelist - extract files from content file
#
# Copyright (C) 2009-2016
# Tobias Dreyer <dreyer@molgen.mpg.de>
# Marius Tolzmann <m@rius.berlin>
# and other bee developers
#
# This file is part of bee.
#
# bee is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
: ${BEE_BINDIR=@BINDIR@}
options=$(${BEE_BINDIR}/beegetopt --name content2filelist \
--option append/a= \
--option prepend/p= \
--option sort/s: \
-- "$@")
if [ $? != 0 ] ; then
exit 1
fi
eval set -- "${options}"
declare append=""
declare prepend=""
declare sortopts=""
declare -i opt_sort=0
while true ; do
case "$1" in
--append)
append=${2}
shift 2
;;
--prepend)
prepend=${2}
shift 2
;;
--sort)
opt_sort=1
sortopts=${2}
shift 2
;;
--)
shift
break
;;
esac
done
function do_convert()
{
cat "${@}" | sed \
-e 's,^.*:file=,,' \
-e 's,\(^.*\)//.*$,\1,' \
-e 's,/$,,' \
-e "s,^,${prepend}," \
-e "s,\$,${append},"
}
if [ "${opt_sort}" = "1" ] ; then
do_convert "${@}" | sort ${sortopts}
else
do_convert "${@}"
fi