Skip to content

Commit 98a34e3

Browse files
committed
Added git-issue command, man page and updated README
1 parent 4d87da4 commit 98a34e3

File tree

14 files changed

+125
-6
lines changed

14 files changed

+125
-6
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ git pr # Create a new PR from current branch to master
5050
git pr -s feature/1-my-feature -d develop # Create a PR from a feature branch to develop branch
5151

5252
git issues # Open issues list
53+
54+
git issue # Create a new issue
5355
```
5456

5557
For more information, use `git help [command]` or `git [command] --help`. For example: `git help web`.
@@ -77,6 +79,7 @@ The following features are available for git providers:
7779
| Fork a repository | NP | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
7880
| Open issues list | NP | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
7981
| Open an specific issue | NP | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
82+
| Create a new issue | NP | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
8083

8184
> NP: Not provided. Feature is not available in the provider.
8285

docs/git-ci.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ Copyright (c) 2020, Joaquín Ormaechea (MIT).
4545

4646
## SEE ALSO
4747

48-
git-fork(1), git-issues(1), git-prs(1), git-pr(1), git-web(1)
48+
git-fork(1), git-issue(1), git-issues(1), git-prs(1), git-pr(1), git-web(1)

docs/git-fork.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ Copyright (c) 2020, Joaquín Ormaechea (MIT).
3838

3939
## SEE ALSO
4040

41-
git-ci(1), git-issues(1), git-pr(1), git-prs(1), git-web(1)
41+
git-ci(1), git-issue(1), git-issues(1), git-pr(1), git-prs(1), git-web(1)

docs/git-issue.1.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# git-issue
2+
3+
> Git Issue - Interact with your git provider from your command line.
4+
5+
For more information about the project, visit [Git web](https://github.com/jormaechea/git-web).
6+
7+
## DESCRIPTION
8+
9+
Create an issue in your git repository provider in the browser.
10+
11+
## SYNOPSIS
12+
13+
`git issue [--remote remote-name]`
14+
15+
## ARGUMENTS
16+
17+
`--remote`, `-r`
18+
Use a different remote. Default: `origin`
19+
20+
`--help`
21+
Show this help message
22+
23+
## EXAMPLES
24+
25+
`git issue`
26+
27+
## Website
28+
29+
[](https://github.com/jormaechea/git-web)
30+
31+
## BUGS
32+
33+
Please report any bugs to [](https://github.com/jormaechea/git-web/issues).
34+
35+
## LICENSE
36+
37+
Copyright (c) 2020, Joaquín Ormaechea (MIT).
38+
39+
## SEE ALSO
40+
41+
git-ci(1), git-fork(1), git-issues(1), git-pr(1), git-prs(1), git-web(1)

docs/git-issues.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ Copyright (c) 2020, Joaquín Ormaechea (MIT).
4545

4646
## SEE ALSO
4747

48-
git-ci(1), git-fork(1), git-pr(1), git-prs(1), git-web(1)
48+
git-ci(1), git-fork(1), git-issue(1), git-pr(1), git-prs(1), git-web(1)

docs/git-pr.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ Copyright (c) 2020, Joaquín Ormaechea (MIT).
5252

5353
## SEE ALSO
5454

55-
git-ci(1), git-fork(1), git-issues(1), git-prs(1), git-web(1)
55+
git-ci(1), git-fork(1), git-issue(1), git-issues(1), git-prs(1), git-web(1)

docs/git-prs.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ Copyright (c) 2020, Joaquín Ormaechea (MIT).
4545

4646
## SEE ALSO
4747

48-
git-ci(1), git-fork(1), git-issues(1), git-pr(1), git-web(1)
48+
git-ci(1), git-fork(1), git-issue(1), git-issues(1), git-pr(1), git-web(1)

docs/git-web.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ Copyright (c) 2020, Joaquín Ormaechea (MIT).
4747

4848
## SEE ALSO
4949

50-
git-ci(1), git-fork(1), git-issues(1), git-prs(1), git-pr(1)
50+
git-ci(1), git-fork(1), git-issue(1), git-issues(1), git-prs(1), git-pr(1)

lib/cli/issue.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env node
2+
3+
'use strict';
4+
5+
const { log } = console;
6+
7+
const open = require('open');
8+
9+
const { argv } = require('./yargs-base');
10+
11+
const isInWorkingDir = require('../helpers/git/is-in-working-dir');
12+
const getRemote = require('../helpers/git/get-remote');
13+
const remoteToUrl = require('../helpers/git/remote-to-url');
14+
15+
const createIssueProviders = require('../providers/issue');
16+
17+
(async () => {
18+
19+
if(!await isInWorkingDir()) {
20+
log('Not in a git repository!');
21+
process.exit(1);
22+
}
23+
24+
const remote = await getRemote(argv.remote);
25+
26+
const repositoryUrl = remoteToUrl(createIssueProviders, remote);
27+
28+
log(`Opening repository in the browser: ${repositoryUrl}`);
29+
open(repositoryUrl);
30+
31+
})();

lib/providers/issue/bitbucket.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
const {
4+
getBaseUrl
5+
} = require('../base/bitbucket');
6+
7+
module.exports.mapRemoteToUrl = remoteUrlData => {
8+
9+
const baseUrl = getBaseUrl(remoteUrlData);
10+
11+
return `${baseUrl}/issues/new`;
12+
};

0 commit comments

Comments
 (0)