Main Call Function *
512763
function callHook() {
		global $default; // Should take care of this later.
		$queryString = array();

		if (!isset($this->url)) {

			$controller = $this->routes['default']['controller'];
			$action = $this->routes['default']['action'];
		} else {
			//print "URL: " . $this->url . "<br>";
			$this->routeURL(); // Replace the URL with something else based on preg_matches defined in the routing
			//print "URL: " . $this->url . "<br>";
			$urlArray = array();
			$urlArray = explode("/",$this->url);
			$controller = $urlArray[0];
			array_shift($urlArray); // Pop the first element
			if (!$controller){
				$controller="index";  // Default Controller
			}

			if (isset($urlArray[0])) {
				$action = $urlArray[0];
				array_shift($urlArray); // pop the second element
			} else {
				$action = 'index'; // Default Action
			}
			$queryString = $urlArray;
		}

		$controllerName = ucfirst($controller).'Controller';
		//print "Calling $controllerName with $controller and $action at ";
		$this->runControllerAction($controller, $action, $queryString, $controllerName, $action);

	}
932478
def main():
    
    name = sys.argv[1]
    path = filepath.FilePath('.stat').temporarySibling()
    path.makedirs()
    func = makeBenchmarkRunner(path, sys.argv[1:])
    try:
        bench(name, path, func)
    finally:
        path.remove()
125873
function run() {
		$fw=\Base::instance();
		// Assign signal handlers
		declare(ticks=1);
		pcntl_signal(SIGINT,[$this,'kill']);
		pcntl_signal(SIGTERM,[$this,'kill']);
		gc_enable();
		// Activate WebSocket listener
		$listen=stream_socket_server(
			$this->addr,$errno,$errstr,
			STREAM_SERVER_BIND|STREAM_SERVER_LISTEN,
			$this->ctx
		);
		$socket=socket_import_stream($listen);
		register_shutdown_function(function() use($listen) {
			foreach ($this->sockets as $socket)
				if ($socket!=$listen)
					$this->close($socket);
			$this->close($listen);
			if (isset($this->events['stop']) &&
				is_callable($func=$this->events['stop']))
				$func($this);
		});
		if ($errstr)
			user_error($errstr,E_USER_ERROR);
		if (isset($this->events['start']) &&
			is_callable($func=$this->events['start']))
			$func($this);
		$this->sockets=[(int)$listen=>$listen];
		$empty=[];
		$wait=$this->wait;
		while (TRUE) {
			$active=$this->sockets;
			$mark=microtime(TRUE);
			$count=@stream_select(
				$active,$empty,$empty,(int)$wait,round(1e6*($wait-(int)$wait))
			);
			if (is_bool($count) && $wait) {
				if (isset($this->events['error']) &&
					is_callable($func=$this->events['error']))
					$func($this);
				die;
			}
			if ($count) {
				// Process active connections
				foreach ($active as $socket) {
					if (!is_resource($socket))
						continue;
					if ($socket==$listen) {
						if ($socket=@stream_socket_accept($listen,0))
							$this->alloc($socket);
						else
						if (isset($this->events['error']) &&
							is_callable($func=$this->events['error']))
							$func($this);
					}
					else {
						$id=(int)$socket;
						if (isset($this->agents[$id]))
							$this->agents[$id]->fetch();
					}
				}
				$wait-=microtime(TRUE)-$mark;
				while ($wait<1e-6) {
					$wait+=$this->wait;
					$count=0;
				}
			}
			if (!$count) {
				$mark=microtime(TRUE);
				foreach ($this->sockets as $id=>$socket) {
					if (!is_resource($socket))
						continue;
					if ($socket!=$listen &&
						isset($this->agents[$id]) &&
						isset($this->events['idle']) &&
						is_callable($func=$this->events['idle']))
						$func($this->agents[$id]);
				}
				$wait=$this->wait-microtime(TRUE)+$mark;
			}
			gc_collect_cycles();
		}
	}
120692
function main(args) {
  return new Promise((resolve, reject) => {
    let b = browserifyArgs(['--node', '--no-detect-globals'].concat(args));
    let outdir = (b.argv.outdir || b.argv.o);
    if (b.argv._[0] === 'help' || b.argv.h || b.argv.help ||
      (process.argv.length <= 2 && process.stdin.isTTY)) {
      reject(new Error('Usage: collect-js-deps --outdir <path> [--list] ' +
        '{BROWSERIFY-OPTIONS} [entry files]'));
      return;
    }
    if (!outdir && !b.argv.list) {
      reject(new Error('collect-js-deps requires --outdir (-o) option for output directory, or --list'));
      return;
    }
    collect_js_deps(b, { list: b.argv.list, outdir });
    b.bundle((err, body) => err ? reject(err) : resolve());
  });
}
440399
def main():
    """"""
    options = docopt(__doc__, version=__version__)
    if options['segment']:
        segment(
            options['<file>'],
            options['--output'],
            options['--target-duration'],
            options['--mpegts'],
        )
223796
public function main()
    {
        $this->out('CodeBlastr Queue Plugin:');
        $this->hr();
        $this->out('Usage:');
        $this->out('	cake CodeBlastr.Queue help');
        $this->out('		-> Display this Help message');
//        $this->out('	cake Queue.Queue add <taskname>');
//        $this->out('		-> Try to call the cli add() function on a task');
//        $this->out('		-> tasks may or may not provide this functionality.');
        $this->out('	cake Queue.Queue runworker');
        $this->out('		-> run a queue worker, which will look for a pending task it can execute.');
        $this->out('		-> the worker will always try to find jobs matching its installed Tasks');
        $this->out('		-> see "Available Tasks" below.');
        $this->out('	cake Queue.Queue runworker');
        $this->out('		-> run a queue worker, which will look for a pending task it can execute.');
        $this->out('		-> the worker will always try to find jobs matching its installed Tasks');
        $this->out('		-> see "Available Tasks" below.');
        $this->out('	cake Queue.Queue stats');
        $this->out('		-> Display some general Statistics.');
        $this->out('	cake Queue.Queue clean');
        $this->out('		-> Manually call cleanup function to delete task data of completed tasks.');
    }
589678
function main() {
  var server = new grpc.Server();
  server.addService(hello_proto.Greeter.service, {sayHello: sayHello});
  server.bind('0.0.0.0:50051', grpc.ServerCredentials.createInsecure());
  server.start();
}
733179
public function main()
    {
        if (!$this->param('xml') && !$this->param('version')) {
            $this->out('<info>Current Paths:</info>', 2);
            $this->out('* app:  ' . APP_DIR . DIRECTORY_SEPARATOR);
            $this->out('* root: ' . ROOT . DIRECTORY_SEPARATOR);
            $this->out('* core: ' . CORE_PATH);
            $this->out('');

            $this->out('<info>Available Shells:</info>', 2);
        }

        if ($this->param('version')) {
            $this->out(Configure::version());

            return;
        }

        $shellList = $this->Command->getShellList();
        if (!$shellList) {
            return;
        }

        if (!$this->param('xml')) {
            $this->_asText($shellList);
        } else {
            $this->_asXml($shellList);
        }
    }
180858
def main():
    
    parser = parser_setup()
    options = parser.parse_args()

    debug = bool(options.debug > 0)
    debugall = bool(options.debug > 1)

    awsc.init()
    debg.init(debug, debugall)
    print(C_NORM)

    options.func(options)

    sys.exit()
1355762
public function main()
    {
        $msg = '';
        $title = 'Phing';
        $executable = 'notify-send';

        if ($this->title != '') {
            $title = "'" . $this->title . "'";
        }

        if ($this->msg != '') {
            $msg = "'" . $this->msg . "'";
        }

        $cmd = $executable . ' -i ' . $this->icon . ' ' . $title . ' ' . $msg;

        $this->log(sprintf("Title: '%s'", $title), Project::MSG_DEBUG);
        $this->log(sprintf("Message: '%s'", $msg), Project::MSG_DEBUG);
        $this->log($msg, Project::MSG_INFO);

        $this->log(sprintf("cmd: %s", $cmd), Project::MSG_DEBUG);
        if (!$this->silent) {
            $fs = FileSystem::getFileSystem();
            if ($fs->which($executable) !== false) {
                exec(escapeshellcmd($cmd), $output, $return);
                if ($return !== 0) {
                    throw new BuildException("Notify task failed.");
                }
            } else {
                $this->log("Executable ($executable) not found", Project::MSG_DEBUG);
            }
        } else {
            $this->log("Silent flag set; not executing", Project::MSG_DEBUG);
        }
    }
1253083
public function main()
    {
        $this->setup();
        while (!$this->eos()) {
            $p = $this->pos();
            $state = $this->stateName();

            $this->loadTransitions();
            list($nextPatternData, $nextPatternIndex, $nextPatternMatches) = $this->nextStartData();
            list($endIndex, $endMatches) = $this->nextEndData();

            if (($nextPatternIndex <= $endIndex || $endIndex === -1) && $nextPatternIndex !== -1) {
                // we're pushing a new state
                if ($p < $nextPatternIndex) {
                    $this->recordRange($p, $nextPatternIndex);
                }
                $newPos = $nextPatternIndex;
                $this->pos($newPos);
                $tok = $nextPatternData[0];
                if (isset($this->overrides[$tok])) {
                    // call override
                    $ret = call_user_func($this->overrides[$tok], $nextPatternMatches);
                    if ($ret === true) {
                        break;
                    }
                    if ($this->stateName() === $state && $this->pos() <= $newPos) {
                        throw new Exception('Override failed to either advance the pointer or change the state');
                    }
                } else {
                    // no override
                    $this->posShift(strlen($nextPatternMatches[0]));
                    $this->pushState($nextPatternData);
                    $this->record($nextPatternMatches[0]);
                    if ($nextPatternData[2] === null) {
                        // state was a full pattern, so pop now
                        $this->popState();
                    }
                }
            } elseif ($endIndex !== -1) {
                // we're at the end of a state, record what's left and pop it
                $to = $endIndex + strlen($endMatches[0]);
                $this->recordRange($this->pos(), $to);
                $this->pos($to);
                $this->popState();
            } else {
                // no more matches, consume the rest of the stirng and break
                $this->record($this->rest());
                $this->terminate();
                break;
            }
            if ($this->stateName() === $state && $this->pos() <= $p) {
                throw new Exception('Failed to advance pointer in state' . $this->stateName());
            }
        }

        // unterminated states will have left some tokens open, we need to
        // close these so there's just the root node on the stack
        assert(count($this->tokenTreeStack) >= 1);
        while (count($this->tokenTreeStack) > 1) {
            $this->popState();
        }

        return $this->tokenTreeStack[0];
    }
18758
def main():
    ''''''
    global output
    if len(sys.argv[1:]) == 1:
        with io.open(sys.argv[1], 'r', encoding='utf-8') as f:
            output = load(f)
    else:
        output = load(sys.stdin)

    dump(output, sys.stdout)
144142
async function main() { // eslint-disable-line no-unused-vars
  try {
    // `path` is the absolute path to the executable.
    const path = await which('foobar');
    console.log(`The command "foobar" is located at: ${path}`);
  }

  catch (err) {
    // `err` is an instance of `FinderError`.
    console.log(`The command "${err.command}" was not found`);
  }
}
5515
public function main()
    {
        LibraryLoader::includeAll();

        $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
        $this->doc->backPath = $GLOBALS['BACK_PATH'];

        if ($GLOBALS['BE_USER']->user['admin']) {
            $this->doc->bodyTagAdditions = 'id="doc3"';

            $this->addAdditionalHeaderData();

            $this->cleanOutputBuffers();
            $this->outputService->output(
                $this->doc->startPage($this->translate('title')) .
                $this->doc->header(\PHPUnit_Runner_Version::getVersionString())
            );

            $this->renderRunTests();

            $this->outputService->output(
                $this->doc->section(
                    $this->translate('shortcuts.title'),
                    '<p>' . $this->translate('shortcuts.text') . '</p>
                    <p>' . $this->translate('shortcuts.browser_dependency') . '</p>
                    <ul>
                    <li>' . $this->translate('shortcuts.browser_safari_ie') . '</li>
                    <li>' . $this->translate('shortcuts.browser_firefox') . '</li>
                    </ul>'
                )
            );
        } else {
            $this->outputService->output(
                $this->doc->startPage($this->translate('title')) .
                $this->doc->header($this->translate('title')) .
                $this->translate('admin_rights_needed')
            );
        }

        $this->outputService->output($this->doc->endPage());
    }
1297771
def main():
    """"""
    parser = get_parser()
    args = parser.parse_args()

    # set up variables
    ARCHIVE = args.archive_path
    archive = (not args.no_archive)
    os.environ['F2FORMAT_VERSION'] = args.python
    os.environ['F2FORMAT_ENCODING'] = args.encoding

    def find(root):
        """Recursively find all files under root."""
        flst = list()
        temp = os.listdir(root)
        for file in temp:
            path = os.path.join(root, file)
            if os.path.isdir(path):
                flst.extend(find(path))
            elif os.path.isfile(path):
                flst.append(path)
            elif os.path.islink(path):  # exclude symbolic links
                continue
        yield from flst

    def rename(path):
        stem, ext = os.path.splitext(path)
        name = '%s-%s%s' % (stem, uuid.uuid4(), ext)
        return os.path.join(ARCHIVE, name)

    # make archive directory
    if archive:
        os.makedirs(ARCHIVE, exist_ok=True)

    # fetch file list
    filelist = list()
    for path in sys.argv[1:]:
        if os.path.isfile(path):
            if archive:
                dest = rename(path)
                os.makedirs(os.path.dirname(dest), exist_ok=True)
                shutil.copy(path, dest)
            filelist.append(path)
        if os.path.isdir(path):
            if archive:
                shutil.copytree(path, rename(path))
            filelist.extend(find(path))

    # check if file is Python source code
    def ispy(file): return (os.path.isfile(file) and (os.path.splitext(file)[1] in ('.py', '.pyw')))
    filelist = sorted(filter(ispy, filelist))

    # if no file supplied
    if len(filelist) == 0:
        parser.error('argument PATH: no valid source file found')

    # process files
    if mp is None  or CPU_CNT <= 1:
        [f2format(filename) for filename in filelist]
    else:
        mp.Pool(processes=CPU_CNT).map(f2format, filelist)
310790
public function main()
    {
        $command = sprintf(
            'php -S %s:%d -t %s',
            $this->_host,
            $this->_port,
            escapeshellarg($this->_documentRoot)
        );

        if (!empty($this->_iniPath)) {
            $command = sprintf('%s -c %s', $command, $this->_iniPath);
        }

        $command = sprintf('%s %s', $command, escapeshellarg($this->_documentRoot . '/index.php'));

        $port = ':' . $this->_port;
        $this->out(sprintf('built-in server is running in http://%s%s/', $this->_host, $port));
        $this->out(sprintf('You can exit with <info>`CTRL-C`</info>'));
        system($command);
    }
945487
public function main()
    {
        $logger = Log::engine($this->params['logger']);
        $engine = $this->getEngine($logger);
        $worker = $this->getWorker($engine, $logger);
        $worker->work();
    }