|
|
3b853a |
#!/bin/bash
|
|
|
3b853a |
#
|
|
|
111205 |
# prepare_getArguments.sh -- This function interpretes arguments passed
|
|
|
8e457b |
# to `prepare' functionality and calls actions accordingly.
|
|
|
3b853a |
#
|
|
|
9f5f2e |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
# it under the terms of the GNU General Public License as published by
|
|
|
dcd347 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
dcd347 |
# your option) any later version.
|
|
|
fa95b1 |
#
|
|
|
74a058 |
# This program is distributed in the hope that it will be useful, but
|
|
|
74a058 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
3b853a |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
3b853a |
# General Public License for more details.
|
|
|
3b853a |
#
|
|
|
3b853a |
# You should have received a copy of the GNU General Public License
|
|
|
3b853a |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
3b853a |
# ----------------------------------------------------------------------
|
|
|
3b853a |
# $Id$
|
|
|
3b853a |
# ----------------------------------------------------------------------
|
|
|
3b853a |
|
|
|
111205 |
function prepare_getArguments {
|
|
|
3b853a |
|
|
|
705eab |
# Define short options we want to support.
|
|
|
705eab |
local ARGSS=""
|
|
|
3b853a |
|
|
|
705eab |
# Define long options we want to support.
|
|
|
3ccb0a |
local ARGSL="quiet,answer-yes,packages,links,environment"
|
|
|
3b853a |
|
|
|
705eab |
# Parse arguments using getopt(1) command parser.
|
|
|
705eab |
cli_doParseArguments
|
|
|
3b853a |
|
|
|
705eab |
# Reset positional parameters using output from (getopt) argument
|
|
|
705eab |
# parser.
|
|
|
705eab |
eval set -- "$ARGUMENTS"
|
|
|
08abde |
|
|
|
705eab |
# Look for options passed through command-line.
|
|
|
705eab |
while true; do
|
|
|
705eab |
case "$1" in
|
|
|
705eab |
|
|
|
65dd41 |
--quiet )
|
|
|
65dd41 |
FLAG_QUIET="true"
|
|
|
65dd41 |
FLAG_DONT_COMMIT_CHANGES="true"
|
|
|
65dd41 |
shift 1
|
|
|
65dd41 |
;;
|
|
|
65dd41 |
|
|
|
3ccb0a |
--answer-yes )
|
|
|
3ccb0a |
FLAG_ANSWER="true"
|
|
|
3ccb0a |
shift 1
|
|
|
65dd41 |
;;
|
|
|
65dd41 |
|
|
|
705eab |
--packages )
|
|
|
8e457b |
FLAG_PACKAGES="true"
|
|
|
8e457b |
shift 1
|
|
|
705eab |
;;
|
|
|
705eab |
|
|
|
705eab |
--links )
|
|
|
8e457b |
FLAG_LINKS="true"
|
|
|
8e457b |
shift 1
|
|
|
705eab |
;;
|
|
|
705eab |
|
|
|
705eab |
--environment )
|
|
|
8e457b |
FLAG_ENVIRONMENT="true"
|
|
|
8e457b |
shift 1
|
|
|
705eab |
;;
|
|
|
705eab |
|
|
|
705eab |
* )
|
|
|
705eab |
break
|
|
|
705eab |
esac
|
|
|
705eab |
done
|
|
|
705eab |
|
|
|
3b853a |
}
|