Elegant Way To Pass Configuration To yiic? I am trying to write a console plugin for yiic so that I can import data programmatically from an old site.

I have a multi configuration setup for the craft site. Is there an elegant way to tell yiic which configuration I am targeting (so that it opens the right database etc)?
ok i used the answer brad bell posted above and enhanced it slightly. i wanted to be able to specify the target environment on the command line, and i didn't want to edit a framework file to do it.

so i created the following file, yiic_frontend.php, placed it in $root/utils (a new dir), and call it using php $root/utils/yiic_frontend.php --env=envname plugin cmd:

&lt;?php

/**
 * a front end for yiic.php that looks for env on cmdline and sets CRAFT_ENVIRONMENT
 * accordingly. I put this script in a folder called "utils" in the root of my website
 * install. So instead of doing something like
 *     php $root/craft/app/etc/console/yiic.php plugin cmd
 * you would call
 *     php $root/utils/yiic_frontend.php --env=envname plugin cmd
 * where "envname" is the config environment you wish to use.
 */

for ($i = 1; $i &lt; count($_SERVER['argv']); $i++) {
    $arg = $_SERVER['argv'][$i];
    if (strpos($arg, '--env=') === 0) {
        $env = explode('=', $arg)[1];
        printf("---- setting env \"%s\"\n", $env);
        define('CRAFT_ENVIRONMENT', $env);
        array_splice($_SERVER['argv'], $i, 1);
        break;
    }
}

require(__DIR__ . '/../craft/app/etc/console/yiic.php');