mirror of
https://github.com/Ekokumppanit/ystavakylaecard.git
synced 2026-01-26 11:14:04 +00:00
33 lines
746 B
PHP
33 lines
746 B
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
require_once 'lib/spark/spark_source.php';
|
|
require_once 'lib/spark/spark_cli.php';
|
|
|
|
// define a source
|
|
$sources = array();
|
|
if ($fh = @fopen(dirname(__FILE__) . '/lib/spark/sources', 'r'))
|
|
{
|
|
while ($line = fgets($fh))
|
|
{
|
|
$line = trim($line);
|
|
if ($line && $line[0] != '#') $sources[] = new Spark_source($line);
|
|
}
|
|
fclose($fh);
|
|
}
|
|
|
|
if (count($sources) == 0)
|
|
{
|
|
$default_source = 'sparks.oconf.org';
|
|
Spark_utils::warning("No sources found, using $default_source");
|
|
$sources[] = new Spark_source($default_source);
|
|
}
|
|
|
|
// take commands
|
|
$cli = new Spark_CLI($sources);
|
|
|
|
$cmd = $argc > 1 ? $argv[1] : null;
|
|
$args = $argc > 2 ? array_slice($argv, 2) : array();
|
|
|
|
$cli->execute($cmd, $args);
|