add cmd line args and comments
This commit is contained in:
parent
dde8ef1fb5
commit
54e3273d57
@ -8,15 +8,24 @@ include("src/Label.php");
|
|||||||
include("src/Repo.php");
|
include("src/Repo.php");
|
||||||
$config=include("config.php");
|
$config=include("config.php");
|
||||||
|
|
||||||
$client=new Client($config['url'],$config['user'],$config['pass'],true);
|
//pass cmd line args
|
||||||
$repo=$client->getRepo('james','test');
|
if($argc<3){
|
||||||
|
die(basename(__FILE__)." <USER> <REPO> [debug]\n");
|
||||||
|
}
|
||||||
|
$debug = ($argc==4 && $argv[3]=='debug');
|
||||||
|
|
||||||
|
//open connection and repo
|
||||||
|
$client=new Client($config['url'],$config['user'],$config['pass'],$debug);
|
||||||
|
$repo=$client->getRepo($argv[1],$argv[2]);
|
||||||
|
|
||||||
|
//get the labels of interest
|
||||||
$nolabelLabel=$repo->getLabelByName('no-label');
|
$nolabelLabel=$repo->getLabelByName('no-label');
|
||||||
if(!$nolabelLabel) die ("Can't find 'no-label' label in repo\n");
|
if(!$nolabelLabel) die ("Can't find 'no-label' label in repo\n");
|
||||||
|
|
||||||
$nomilestoneLabel=$repo->getLabelByName('no-milestone');
|
$nomilestoneLabel=$repo->getLabelByName('no-milestone');
|
||||||
if(!$nomilestoneLabel) die ("Can't find 'no-milestone' label in repo\n");
|
if(!$nomilestoneLabel) die ("Can't find 'no-milestone' label in repo\n");
|
||||||
|
|
||||||
|
//define the function to process each issue
|
||||||
$callback=function($issue) use ($nolabelLabel,$nomilestoneLabel){
|
$callback=function($issue) use ($nolabelLabel,$nomilestoneLabel){
|
||||||
// do the no-label thing
|
// do the no-label thing
|
||||||
$labelCount=count($issue->getData()->labels);
|
$labelCount=count($issue->getData()->labels);
|
||||||
@ -35,4 +44,5 @@ $callback=function($issue) use ($nolabelLabel,$nomilestoneLabel){
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//loop through issues and call the callback
|
||||||
$repo->forIssues($callback);
|
$repo->forIssues($callback);
|
||||||
|
Loading…
Reference in New Issue
Block a user