diff --git a/bin/cmd.js b/bin/cmd.js index a6034ee..38df0e0 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -59,6 +59,11 @@ function loadPatch(uri, cb) { var h = http if (~uri.protocol.indexOf('https')) { h = https + } else if (~uri.protocol.indexOf('file:')) { + return fs.readFile(uri.pathname, (err, data) => { + if (err) return cb(err) + return cb(null, data.toString('utf-8')) + }) } uri.headers = { 'user-agent': 'core-validate-commit' diff --git a/bin/usage.txt b/bin/usage.txt index 0e2efba..6ff6082 100644 --- a/bin/usage.txt +++ b/bin/usage.txt @@ -25,3 +25,8 @@ core-validate-commit - Validate the commit message for a particular commit in no Passing a url to a specific sha on github: $ core-validate-commit https://api.github.com/repos/nodejs/node/git/commits/9e9d499b8be8ffc6050db25129b042507d7b4b02 + + Passing a file containing a single commit message: + + $ core-validate-commit file:///tmp/commitmsg.txt +