Permalink
Browse files

fixed regex for replacing github ticket numbers with url to the ticke…

…t so it wouldn't blindly match #.
  • Loading branch information...
1 parent ffc5808 commit ece01b220b06e27d7d1e96e8ee5f5099c1d6918c @dylang committed Aug 24, 2011
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/cli.js
  2. +2 −2 lib/output.js
View
@@ -7,7 +7,7 @@ var log = require('./log');
var FS = require('fs');
var Util = require('./util');
-CLI.setUsage('changelog <npm module name or github repo url> [OPTIONS]').parse({
+CLI.setUsage('changelog <npm module name or github repo url> [OPTIONS]. \n More help at https://github.com/dylang/changelog').parse({
color: ['c', 'Output as Color (terminal default)'],
markdown: ['m', 'Output as Github-flavored Markdown (file default)'],
json: ['j', 'Output as JSON'],
@@ -34,7 +34,7 @@ CLI.main(function (args, options) {
Step(
function() {
if (!project) {
- throw new Error('Usage: changelog <npm module name or github.com repo url>');
+ throw new Error('Need help? --help or more help at https://github.com/dylang/changelog');
} else {
if (project.match(/github.com/)) {
var repo = project.match(/github\.com\/([^\/]*\/[^\/]*)/);
View
@@ -23,7 +23,7 @@ function color(data, cb) {
if (!uniqueChanges[change.message]) {
var message = change.message
.replace(/([^`]*)`([^`]*)`([^`]*)/g, '$1' + Color.GREEN + '$2' + Color.RESET + '$3')
- .replace(/#([0-9]*)/g, Color.CYAN + 'https://github.com/' + data.project.github + '/issues/$1' + Color.RESET)
+ .replace(/#([0-9]+)/g, Color.CYAN + 'https://github.com/' + data.project.github + '/issues/$1' + Color.RESET)
.replace(/^(\[[^\]]*\])/, Color.GREY + '$1' + Color.RESET);
output.push(Color.RESET + Util.bullet(message) + Color.RESET);
}
@@ -59,7 +59,7 @@ function markdown(data, cb) {
if (!uniqueChanges[change.message]) {
var message = change.message;
if (data.project && data.project.github) {
- message = message.replace(/#([0-9]*)/g, '[#$1](https://github.com/' + data.project.github + '/issues/$1' + ')');
+ message = message.replace(/#([0-9]+)/g, '[#$1](https://github.com/' + data.project.github + '/issues/$1' + ')');
}
output.push(Util.bullet(message, '*'));
}

0 comments on commit ece01b2

Please sign in to comment.