Skip to content

Commit

Permalink
Merge pull request #44 from hotoo/feat/branches
Browse files Browse the repository at this point in the history
feat: open branches page.
  • Loading branch information
hotoo authored Feb 9, 2017
2 parents b86a114 + bf7bbec commit 556762b
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions bin/open-commander.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ module.exports = function(argv, option, callback) {
options.category = 'commits-with-branch';
}
break;
case 'brs':
case 'branchs':
case 'branches':
options.category = 'branches';
break;
case 'gist':
case 'snip':
case 'snippet':
Expand Down
5 changes: 5 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ module.exports = function(uri, options) {
path = scheme['commits-with-branch']
.replace('{branch-name}', options.branch);
break;
case 'brs':
case 'branchs':
case 'branches':
path = scheme['branches'];
break;
case 'tree':
path = scheme.tree.replace('{hash}', options.hash)
.replace('{path}', options.args.path);
Expand Down
1 change: 1 addition & 0 deletions lib/scheme/bitbucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
'commit': '/commits/{hash}',
'commits': '/commits',
'commits-with-branch': '/commits/{branch-name}',
'branches': '/branches/',
'milestones': '/admin/issues/milestones',
'milestones/new': '/admin/issues/milestones',
'milestones/id': '/issues?milestone={milestone-id}&status=open&status=new',
Expand Down
3 changes: 2 additions & 1 deletion lib/scheme/coding.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
module.exports = {
'base': '{protocol}://{hostname}/u/{username}/p/{reponame}',
'base': '{protocol}://coding.net/u/{username}/p/{reponame}',
'home': '/git',
'issues': '/topic',
'issues/id': '/topic/{issue-id}',
Expand All @@ -13,6 +13,7 @@ module.exports = {
'commit': '/commit/{hash}',
'commits': '/git/commits',
'commits-with-branch': '/git/commits/{branch-name}',
'branches': '/git/branches',
'milestones': '/milestones',
'milestones/new': '/milestones/new',
'milestones/id': '/milestones/{milestone-id}',
Expand Down
1 change: 1 addition & 0 deletions lib/scheme/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
'commit': '/commit/{hash}',
'commits': '/commits',
'commits-with-branch': '/commits/{branch-name}',
'branches': '/branches',
'milestones': '/milestones',
'milestones/new': '/milestones/new',
'milestones/id': '/issues?q=milestone%3A{milestone-id}',
Expand Down
1 change: 1 addition & 0 deletions lib/scheme/gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
'commit': '/commit/{hash}',
'commits': '/commits',
'commits-with-branch': '/commits/{branch-name}',
'branches': '/branches',
'milestones': '/milestones',
'milestones/new': '/milestones/new',
'milestones/id': '/milestones/{milestone-id}',
Expand Down
3 changes: 3 additions & 0 deletions lib/scheme/oschina.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
'use strict';

// https://code.csdn.net/
module.exports = {
'base': '{protocol}://{hostname}/{username}/{reponame}',
'home': '',
Expand All @@ -13,6 +15,7 @@ module.exports = {
'commit': '/commit/{hash}',
'commits': '/commits/master',
'commits-with-branch': '/commits/{branch-name}',
'branches': '/repository/branches',
'milestones': '/milestones',
'milestones/new': '/milestones/new',
'milestones/id': '/milestones/{milestone-id}',
Expand Down
12 changes: 12 additions & 0 deletions test/gitopen.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ describe('gitresolve()', function() {
}).should.be.eql('https://' + test[1] + '/commits?branch=br');
});

it('gitresolve(' + test[0] + ', {branches})', function() {
gitresolve(test[0], {
category: 'branches',
scheme: {
base: '{protocol}://{hostname}/{username}/{reponame}',
'branches': '/branches',
},
}).should.be.eql('https://' + test[1] + '/branches');
});

it('gitresolve(' + test[0] + ', {home})', function() {
gitresolve(test[0], {
category: 'home',
Expand Down Expand Up @@ -473,6 +483,8 @@ describe('$ gitopen', function() {
['commit', '/hotoo/gitopen/commits'],
['commits', '/hotoo/gitopen/commits'],
['ed8d9e3', '/hotoo/gitopen/commit/ed8d9e3'],
['brs', '/hotoo/gitopen/branches'],
['branches', '/hotoo/gitopen/branches'],
['@hotoo', '/hotoo'],
['@hotoo/gitopen', '/hotoo/gitopen'],
['snippet', 'https://gist.github.com/'],
Expand Down

0 comments on commit 556762b

Please sign in to comment.