From f404a60b0213708e43749aee751c6f2332927fc1 Mon Sep 17 00:00:00 2001 From: Ryan Garant Date: Thu, 26 Jul 2018 14:49:40 -0700 Subject: [PATCH] Add inferFromCommitTitle option to config --- README.md | 65 +++++++++++++++++++++++++++----------------------- bin/jira.js | 2 +- gh-plugin.json | 1 + 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 6e9ebba..f782d97 100644 --- a/README.md +++ b/README.md @@ -26,18 +26,18 @@ gh jira ### 1. Create -Option | Usage | Type ---- | --- | --- -`-N`, `--new` | **Required** | `Boolean` -`-p`, `--project` | **Required** | `String` -`-t`, `--title` | **Required** | `String` -`-A`, `--assignee` | *Optional* | `String` -`-C`, `--component`| *Optional* | `String` -`-m`, `--message` | *Optional* | `String` -`-P`, `--priority` | *Optional* | `String` -`-R`, `--reporter` | *Optional* | `String` -`-T`, `--type` | *Optional* | `String` -`-v`, `--version` | *Optional* | `String` +| Option | Usage | Type | +| ------------------- | ------------ | --------- | +| `-N`, `--new` | **Required** | `Boolean` | +| `-p`, `--project` | **Required** | `String` | +| `-t`, `--title` | **Required** | `String` | +| `-A`, `--assignee` | *Optional* | `String` | +| `-C`, `--component` | *Optional* | `String` | +| `-m`, `--message` | *Optional* | `String` | +| `-P`, `--priority` | *Optional* | `String` | +| `-R`, `--reporter` | *Optional* | `String` | +| `-T`, `--type` | *Optional* | `String` | +| `-v`, `--version` | *Optional* | `String` | #### Examples @@ -67,10 +67,10 @@ Option | Usage | Type ### 2. Comment -Option | Usage | Type ---- | --- | --- -`-c`, `--comment`| **Required** | `String` -`-n`, `--number` | **Required** | `Number` +| Option | Usage | Type | +| ----------------- | ------------ | -------- | +| `-c`, `--comment` | **Required** | `String` | +| `-n`, `--number` | **Required** | `Number` | Omitting `--number` will guess issue number from the last commit message. @@ -84,12 +84,17 @@ Omitting `--number` will guess issue number from the last commit message. ### 3. Open in Browser -Option | Usage | Type ---- | --- | --- -`-B`, `--browser` | **Required** | `Boolean` -`-n`, `--number` | **Required** | `Number` +| Option | Usage | Type | +| ----------------- | ------------ | --------- | +| `-B`, `--browser` | **Required** | `Boolean` | +| `-n`, `--number` | **Required** | `Number` | -Omitting `--number` will guess issue number from the last commit message. +* Omitting `--number` will guess issue number from the last commit message. + * If you would prefer to use the branch as the ticket number you can change this setting in `gh-plugin.json`: + +```json + "inferFromCommitTitle": false, +``` #### Examples @@ -101,12 +106,12 @@ Omitting `--number` will guess issue number from the last commit message. ### 4. Transition -Option | Usage | Type ---- | --- | --- -`--transition` | **Required** | `String` -`-n`, `--number` | **Required** | `Number` -`-A`, `--assignee` | *Optional* | `String` -`-m`, `--message` | *Optional* | `String` +| Option | Usage | Type | +| ------------------ | ------------ | -------- | +| `--transition` | **Required** | `String` | +| `-n`, `--number` | **Required** | `Number` | +| `-A`, `--assignee` | *Optional* | `String` | +| `-m`, `--message` | *Optional* | `String` | Omitting `--number` will guess issue number from the last commit message. @@ -140,9 +145,9 @@ Both Jira and GitHub usernames are supported `--assignee` values. ### 5. Status -Option | Usage | Type ---- | --- | --- -`--status` | **Required** | `String` +| Option | Usage | Type | +| ---------- | ------------ | -------- | +| `--status` | **Required** | `String` | #### Examples diff --git a/bin/jira.js b/bin/jira.js index af143b9..51f796f 100755 --- a/bin/jira.js +++ b/bin/jira.js @@ -49,7 +49,7 @@ class Jira { // If number was not found yet, use only the first commit message to // try to infer the issue number. - if (!issue) { + if (!issue || config.plugins.jira.inferFromCommitTitle) { issue = this.getIssueNumberFromText(git.getCommitMessage(branch, 1)); } diff --git a/gh-plugin.json b/gh-plugin.json index fcb980e..10f5530 100644 --- a/gh-plugin.json +++ b/gh-plugin.json @@ -36,6 +36,7 @@ "password": "", "port": "", "protocol": "https", + "inferFromCommitTitle": true, "transition": { "Close Issue": { "Fix Version/s": true