Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,19 @@ export default class Config {
type: 'confirm',
name: 'protocol',
message: 'Enable HTTPS Protocol?'
},
{
type: ' input',
name: 'port',
message: 'Provide your jira port: ',
default: 'https:443|http:80'
Comment on lines +74 to +79
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added jira port question

}
];

return inquirer.prompt(questions).then(function (answers) {

const protocol = answers.protocol ? 'https' : 'http';

const config = {
protocol: protocol.trim(),
host: answers.host.trim(),
Expand All @@ -87,6 +93,9 @@ export default class Config {
strictSSL: true
};

const port = !isNaN(answers.port.trim()) ? answers.port.trim() : (answers.protocol ? '443' : '80');
config.port = port;

return fs.writeFile(filePath, JSON.stringify(config), 'utf8')
.then(function(){
console.log('');
Expand Down Expand Up @@ -153,6 +162,16 @@ export default class Config {
} else {
this.defaults.host = val;

this.updateConfigFile();
}
} else if ( cmd == 'port' ) {
if ( typeof val === 'undefined' ) {
console.log( '' );
console.log( ' Current port: ' + color.blue.bold(this.defaults.port) );
console.log( '' );
} else {
this.defaults.port = val;

this.updateConfigFile();
}
} else if ( cmd == 'password' ) {
Expand Down
3 changes: 2 additions & 1 deletion src/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,10 @@ export default class JiraIssues {
openIssue( issue ) {
const _this = this;
let config = jira.config.defaults;
let portUrlPart = config.port ? ':'+ config.port : '';

jira.api.findIssue( issue ).then(function(){
opn( config.protocol + '://' + config.host + '/browse/' + issue, {wait: false});
opn( config.protocol + '://' + config.host + portUrlPart + '/browse/' + issue, {wait: false});
}).catch(function( res ){
jira.showErrors( res );
process.exit();
Expand Down
2 changes: 1 addition & 1 deletion src/jira.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class JiraCLI {
// Remove config file
if ( cmd == 'remove' ){
this.config.removeConfigFile();
} else if ( cmd == 'host' || cmd == 'username' || cmd == 'password' || cmd == 'board' || cmd == 'proxy'){
} else if ( cmd == 'host' || cmd == 'username' || cmd == 'password' || cmd == 'board' || cmd == 'proxy' || cmd == 'port'){

const val = process.argv.slice(4)[0];

Expand Down