protected function loadCliOptions(array $opts)
    {
        $map = [
            'c' => 'conf_file',   // config file
            's' => 'servers', // server address

            'n' => 'workerNum',  // worker number do all tasks
            'u' => 'user',
            'g' => 'group',

            'l' => 'logFile',
            'p' => 'pidFile',

            'r' => 'maxRunTasks', // max run tasks for a worker
            'x' => 'maxLifetime',// max lifetime for a worker
            't' => 'timeout',
        ];

        // show help
        if (isset($opts['h']) || isset($opts['help'])) {
            $this->showHelp();
        }
        // show version
        if (isset($opts['V']) || isset($opts['version'])) {
            $this->showVersion();
        }

        // load opts values to config
        foreach ($map as $k => $v) {
            if (isset($opts[$k]) && $opts[$k]) {
                $this->config[$v] = $opts[$k];
            }
        }

        // load Custom Config File
        if ($file = $this->config['conf_file']) {
            if (!file_exists($file)) {
                $this->showHelp("Custom config file {$file} not found.");
            }

            $config = require $file;
            $this->setConfig($config);
        }

        // watch modify
        if (isset($opts['w']) || isset($opts['watch'])) {
            $this->config['watch_modify'] = $opts['w'];
        }

        // run as daemon
        if (isset($opts['d']) || isset($opts['daemon'])) {
            $this->config['daemon'] = true;
        }

        // no test
        if (isset($opts['no-test'])) {
            $this->config['no_test'] = true;
        }

        // only added tasks
        if (isset($opts['tasks']) && ($added = trim($opts['tasks'], ','))) {
            $this->config['added_tasks'] = strpos($added, ',') ? explode(',', $added) : [$added];
        }

        if (isset($opts['v'])) {
            $opts['v'] = $opts['v'] === true ? '' : $opts['v'];

            switch ($opts['v']) {
                case '':
                    $this->config['logLevel'] = self::LOG_INFO;
                    break;
                case 'v':
                    $this->config['logLevel'] = self::LOG_PROC_INFO;
                    break;
                case 'vv':
                    $this->config['logLevel'] = self::LOG_WORKER_INFO;
                    break;
                case 'vvv':
                    $this->config['logLevel'] = self::LOG_DEBUG;
                    break;
                case 'vvvv':
                    $this->config['logLevel'] = self::LOG_CRAZY;
                    break;
                default:
                    // $this->config['logLevel'] = self::LOG_INFO;
                    break;
            }
        }
    }