From e1005d7fd10dba4585a781f36ef75aa0040fe79b Mon Sep 17 00:00:00 2001 From: Sasa Bodiroza Date: Tue, 8 Jul 2008 23:32:02 +0200 Subject: Add function usage() to src/med-xpi-pack to print out information on error, or -h/--help --- src/med-xpi-pack | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/med-xpi-pack b/src/med-xpi-pack index 0c7236d..a44698c 100755 --- a/src/med-xpi-pack +++ b/src/med-xpi-pack @@ -26,23 +26,37 @@ INDIR=$1; XPIFILE=$2; +function usage() { + echo -e "med-xpi-pack - Script to produce XPI file from input directory.\n"; + echo "The output XPI file is placed in top-level of the input directory."; + echo "To place it somewhere else, provide relative or absolute path to the"; + echo -e "output XPI file.\n" + echo "To run it call:"; + echo -e "$ med-xpi-pack input_directory output_xpi_file\n"; + echo " input_directory - directory with the XPI source tree"; + echo " output_xpi_file - name of the produced file"; + exit 1; +} + +if [ $1 = "--help" -o $1 = "-h" ] ; then + usage; +fi; + if [ -z $INDIR ] ; then - echo "Missing input directory."; - echo "Usage: med-xpi-pack indir xpiname"; - exit; + echo -e "Missing input directory.\n"; + usage; fi; if [ -z $XPIFILE ] ; then - echo "Missing XPI name."; - echo "Usage: med-xpi-pack indir xpiname"; - exit; + echo -e "Missing XPI name.\n"; + usage; fi; -if [ -e $XPIFILE ] ; then - echo "E: XPI file already exists."; - exit; +if [ -f $XPIFILE ] ; then + echo -e "E: XPI file already exists.\n"; + usage; fi; if [ ! -d $INDIR ] ; then - echo "E: Input directory doesn't exist."; - exit; + echo -e "E: Input directory doesn't exist.\n"; + usage; fi; pushd $INDIR > /dev/null; -- cgit v1.2.3