Skip to content

Commit

Permalink
added sub commands (created, assigned, mentioned) for my issues/pulls
Browse files Browse the repository at this point in the history
closes #54
  • Loading branch information
gharlan committed Apr 17, 2016
1 parent 9280b77 commit 2e7eae0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,16 @@ To search through your GitHub Enterprise instance replace `gh` by `ghe`.
### "My" commands

* `gh my dashboard`
* `gh my issues`
* `gh my notifications`
* `gh my profile`
* `gh my issues`
* `gh my issues created`
* `gh my issues assigned`
* `gh my issues mentioned`
* `gh my pulls`
* `gh my pulls created`
* `gh my pulls assigned`
* `gh my pulls mentioned`
* `gh my settings`
* `gh my stars`
* `gh my gists`
Expand Down
27 changes: 24 additions & 3 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,31 @@ private static function addUserSubCommands($queryUser)

private static function addMyCommands()
{
$parts = self::$parts;
if (isset($parts[2]) && in_array($parts[1], array('pulls', 'issues'))) {
$icon = $parts[1] === 'pulls' ? 'pull-request' : 'issue';
$items = $icon . 's';
$subs = array(
'created' => array($parts[1], 'View your ' . $items),
'assigned' => array($parts[1] . '/assigned', 'View your assigned ' . $items),
'mentioned' => array($parts[1] . '/mentioned', 'View ' . $items . ' that mentioned you'),
);
foreach ($subs as $key => $sub) {
Workflow::addItem(Item::create()
->title('my ' . $parts[1] . ' ' . $key)
->subtitle($sub[1])
->icon($icon)
->arg('/' . $sub[0])
->prio(1)
);
}
return;
}

$myPages = array(
'dashboard' => array('', 'View your dashboard'),
'pulls' => array('pulls', 'View your pull requests', 'pull-request'),
'issues' => array('issues', 'View your issues', 'issue'),
'pulls ' => array('pulls', 'View your pull requests', 'pull-request'),
'issues ' => array('issues', 'View your issues', 'issue'),
'stars' => array('stars', 'View your starred repositories'),
'profile' => array(self::$user->login, 'View your public user profile', 'user'),
'settings' => array('settings', 'View or edit your account settings'),
Expand All @@ -415,7 +436,7 @@ private static function addMyCommands()
Workflow::addItem(Item::create()
->title('my ' . $key)
->subtitle($my[1])
->icon(isset($my[2]) ? $my[2] : $key)
->icon(isset($my[2]) ? $my[2] : rtrim($key))
->arg('/' . $my[0])
->prio(1)
);
Expand Down

0 comments on commit 2e7eae0

Please sign in to comment.