forked from there4/fogbugz-php-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworking.php
executable file
·48 lines (37 loc) · 1.3 KB
/
working.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/*
*/
error_reporting(E_ALL | E_STRICT);
require __DIR__ . "/lib/fogbugz.php";
require __DIR__ . "/lib/io.php";
require __DIR__ . "/lib/termcolor.php";
require __DIR__ . "/lib/commands.php";
require __DIR__ . "/lib/getConfig.php";
/*******************************************************************************/
/* Configuration Begin */
$config_path = $_SERVER['HOME'] . '/.fogbugz';
$config_file = $_SERVER['HOME'] . '/.fogbugz/config.php';
/* Configuration End */
/*******************************************************************************/
$config = array();
if (is_readable($config_file)) {
require_once $config_file;
}
else {
echo "You don't seem to have a config file.\n";
$config = initConfig($config_path);
}
// If the file is bad, bail
if (empty($config)) {
exit("Invalid config file format\n");
}
// We made some changes to the format. If we need more data, let's prompt again
// and give it some defaults
if (empty($config['host'])) {
$config = updateConfig($config_file, $config);
}
$runner = new Commands($config['user'], $config['pass'], $config['host'], $config_path);
$runner->config = $config;
$runner->dispatch($_SERVER['argv']);
exit(0);
/* End of file working.php */