Browse Source

-C change directory option

Former-commit-id: b004511ae68be39b08bcf10b5714510eaf5e4340
Alec Jacobson 8 years ago
parent
commit
87cba2f866
1 changed files with 31 additions and 3 deletions
  1. 31 3
      scripts/autoexplicit.sh

+ 31 - 3
scripts/autoexplicit.sh

@@ -1,7 +1,35 @@
 #!/bin/bash
-# Usage:
-#   cd $LIBIGL/include/igl
-#   make -C [your_project] 2>&1 | ../../scripts/autoexplicit.sh
+
+while getopts ":C:h" opt; do
+  case $opt in
+    C)
+      if ! cd "$OPTARG" 2>/dev/null
+      then
+        (>&2 echo "Failed to change directory to $OPTARG")
+        exit 1
+      fi
+      ;;
+    h)
+      echo "
+Usage:
+  
+    autoexplicit.sh [-C dir] \"
+    Undefined symbols for architecture x86_64:
+     \\\"...\\\" \"
+
+Or 
+
+    make -C [your_project] 2>&1 | autoexplicit.sh -C \$LIBIGL"
+      exit 1
+      ;;
+    \?)
+      echo "Invalid option: -$OPTARG" >&2
+      ;;
+  esac
+done
+
+# Shift so that $# makes sense
+shift $((OPTIND-1))
 
 
 # process input line by line