updated to clean up compiler issues with how functions were used from basis namespace;
[feisty_meow.git] / scripts / generator / wrapdoze.sh
1 #!/bin/bash
2
3 source $FEISTY_MEOW_SCRIPTS/core/functions.sh
4
5 function dossify_and_run_commands()
6 {
7   declare -a darc_commands=()
8
9   for i in "$@"; do
10     # we only mess with the command line on windows.
11     if [ "$OS" == "Windows_NT" ]; then
12       if [[ "$i" =~ ^-[a-zA-z][/\"].* ]]; then
13 #echo matched on our pattern for parameters
14         flag="${i:0:2}"
15         filename="$(unix_to_dos_path ${i:2})"
16
17 #echo "first two chars are $flag"
18 #echo "last after that are $filename"
19 #combined="$flag$filename"
20 #echo combined is $combined
21       
22         darc_commands+=("$flag$filename")
23       else 
24         darc_commands+=($(unix_to_dos_path $i))
25       fi
26     else
27       darc_commands+=("$i")
28     fi
29   done
30
31 #temp!
32   echo commands are now: >>/tmp/wrapdoze.log
33   for i in "${darc_commands[@]}"; do
34     echo $i >>/tmp/wrapdoze.log
35   done
36 #end temp
37
38   # now actually run the possibly chewed command.
39   "${darc_commands[@]}"
40 }
41
42 dossify_and_run_commands "$@"
43