protected function _actionPrepclienv(AnCommandContext $context)
    {
        if (! empty($_SERVER['argv']) && count($_SERVER['argv']) > 1) {
            $args = array_slice($_SERVER['argv'], 1);

            if (is_readable(realpath($args[0]))) {
                $file = array_shift($args);
            }

            $args = explode('&-data&', implode($args, '&'));
            $args = array_filter($args, 'trim');

            foreach ($args as $i => $arg) {
                $arg = trim($arg);

                if ($i == 0) {
                    if (strpos($arg, '/') !== false) {
                        $arg = substr_replace($arg, '?', strpos($arg, '&'), 1);
                        $url = AnService::get('anahita:http.url', array('url' => $arg));
                        AnRequest::url()->path = AnRequest::base().$url->path;
                        $_GET = $url->query;
                    } else {
                        AnRequest::url()->path = AnRequest::base();
                        parse_str($arg, $_GET);
                    }
                } else {
                    parse_str($arg, $_POST);
                }
            }
        }

        $_GET['format'] = 'json';
        AnRequest::url()->format = 'json';
        AnRequest::url()->setQuery($_GET);

        AnService::get('com:plugins.helper')->import('cli');
        dispatch_plugin('cli.onCli');

        //if there's a file then just load the file and exit
        if (! empty($file)) {
            AnService::get('anahita:loader')->loadFile($file);
            exit(0);
        }
    }