#!/bin/sh

# Helper functions for DM commands.

# Fix command line arguments 
DM_COMMAND_ARGS=""
while [ $# -ne 0 ]; do
    arg=$1
    if [[ $arg == -* ]]; then
        key=`echo $arg | cut -f1 -d'='`
        keyHasValue=`echo $arg | grep '='`
        if [ ! -z "$keyHasValue" ]; then
            value=`echo $arg | cut -f2- -d'='`
            DM_COMMAND_ARGS="$DM_COMMAND_ARGS $key=\"$value\""
        else
            DM_COMMAND_ARGS="$DM_COMMAND_ARGS $key"
        fi 
    else
        DM_COMMAND_ARGS="$DM_COMMAND_ARGS \"$arg\""
    fi
    shift
done


