diff options
author | Sasa Bodiroza <jazzva@gmail.com> | 2008-07-08 23:38:59 +0200 |
---|---|---|
committer | Sasa Bodiroza <jazzva@gmail.com> | 2008-07-08 23:38:59 +0200 |
commit | 4c993840831628acbd074f294e1657bcfda54889 (patch) | |
tree | 5f89e609481c4f76d97a982164c6a8dcbd1c0972 | |
parent | e1005d7fd10dba4585a781f36ef75aa0040fe79b (diff) |
Add function usage() to src/med-xpi-unpack to print out information on error, or -h/--help
-rwxr-xr-x | src/med-xpi-unpack | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/med-xpi-unpack b/src/med-xpi-unpack index 53b8bb1..9c66c89 100755 --- a/src/med-xpi-unpack +++ b/src/med-xpi-unpack @@ -24,23 +24,35 @@ XPIFILE=$1; OUTDIR=$2; +function usage() { + echo -e "med-xpi-unpack - Script to unpack XPI file to output directory.\n"; + echo "To run it call:"; + echo -e "$ med-xpi-unpack input_xpi_file output_directory\n"; + echo " input_xpi_file - packed XPI source tree"; + echo " output_directory - location where the unpacke XPI file is placed"; + exit 1; +} + +if [ $1 = "--help" -o $1 = "-h" ] ; then + usage; +fi; + if [ -z $XPIFILE ] ; then - echo "Missing xpiname directory."; - echo "Usage: med-xpi-unpack xpiname outdir"; - exit; + echo -e "Missing XPI file.\n"; + usage; fi; if [ -z $OUTDIR ] ; then - echo "Missing output directory."; - echo "Usage: med-xpi-unpack xpiname outdir"; - exit; + echo -e "Missing output directory.\n"; + usage; fi; if [ -d $OUTDIR ] ; then - echo "E: Output directory already exists."; - exit; + echo -e "E: Output directory already exists.\n"; + usage; fi; -if [ ! -e $XPIFILE ] ; then - echo "E: XPI file doesn't exist."; - exit; + +if [ ! -f $XPIFILE ] ; then + echo -e "E: XPI file doesn't exist.\n"; + usage; fi; mkdir $OUTDIR; |