templates: Update to show usage for new extract_files features

* Allows extracting only a specific section from proprietary-files.txt
* Defaults to not cleaning vendor folder before extraction
* Adds script options rather than depending on apredefined order

Change-Id: I74cd3bf4a1f652232c97c78d6164f0730599c1a7
diff --git a/build/templates/extract-files.sh b/build/templates/extract-files.sh
index d09d2fd..9d13cb0 100755
--- a/build/templates/extract-files.sh
+++ b/build/templates/extract-files.sh
@@ -34,25 +34,31 @@
 fi
 . "$HELPER"
 
-if [ $# -eq 0 ]; then
+# default to not sanitizing the vendor folder before extraction
+clean_vendor=false
+
+while [ "$1" != "" ]; do
+    case $1 in
+        -p | --path )           shift
+                                SRC=$1
+                                ;;
+        -s | --section )        shift
+                                SECTION=$1
+                                clean_vendor=false
+                                ;;
+        -c | --clean-vendor )   clean_vendor=true
+                                ;;
+    esac
+    shift
+done
+
+if [ -z "$SRC" ]; then
     SRC=adb
-else
-    if [ $# -eq 1 ]; then
-        SRC=$1
-    else
-        echo "$0: bad number of arguments"
-        echo ""
-        echo "usage: $0 [PATH_TO_EXPANDED_ROM]"
-        echo ""
-        echo "If PATH_TO_EXPANDED_ROM is not specified, blobs will be extracted from"
-        echo "the device using adb pull."
-        exit 1
-    fi
 fi
 
 # Initialize the helper
-setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
+setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT" false $clean_vendor
 
-extract "$MY_DIR"/proprietary-files.txt "$SRC"
+extract "$MY_DIR"/proprietary-files.txt "$SRC" "$SECTION"
 
 "$MY_DIR"/setup-makefiles.sh