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");
|
||||
$config=include("config.php");
|
||||
|
||||
$client=new Client($config['url'],$config['user'],$config['pass'],true);
|
||||
$repo=$client->getRepo('james','test');
|
||||
//pass cmd line args
|
||||
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');
|
||||
if(!$nolabelLabel) die ("Can't find 'no-label' label in repo\n");
|
||||
|
||||
$nomilestoneLabel=$repo->getLabelByName('no-milestone');
|
||||
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){
|
||||
// do the no-label thing
|
||||
$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);
|
||||
|
Loading…
Reference in New Issue
Block a user