diff --git a/bin/cli.js b/bin/cli.js index 1e7b1f9..76bfb80 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -38,7 +38,11 @@ var config = { require('../lib/commands/auth/register'), require('../lib/commands/auth/whoami'), require('../lib/commands/auth/logout'), - require('../lib/commands/auth/login') + require('../lib/commands/auth/login'), + { + name: 'help', + command: require('../lib/usage') + } ], aliases: { 'init': 'create' diff --git a/lib/usage.js b/lib/usage.js index 586dc4e..de2351b 100644 --- a/lib/usage.js +++ b/lib/usage.js @@ -7,13 +7,14 @@ module.exports = function (opts) { console.error('Usage: dat-next [options]') console.error(' dat-next create create a local dat') console.error(' dat-next snapshot create a local dat snapshot') - console.error(' dat-next sync sync latest files with the network. archive owners import updated files to share.') + console.error(' dat-next sync sync latest files with the network.') console.error(' dat-next clone clone a remote dat') console.error(' dat-next pull download updated files from a remote dat and exit') console.error(' dat-next doctor run the dat network doctor') console.error(' dat-next register register for an account') console.error(' dat-next login login to an account') console.error(' dat-next --version,-v get your dat-next version') + console.error(' dat-next help print this usage guide') console.error('') console.error(' --dir= set directory (all commands)') console.error(' --no-import do not import files (create, sync)') diff --git a/tests/usage.js b/tests/usage.js index b89f0c9..aecdcd3 100644 --- a/tests/usage.js +++ b/tests/usage.js @@ -5,7 +5,7 @@ var spawn = require('./helpers/spawn.js') var dat = path.resolve(path.join(__dirname, '..', 'bin', 'cli.js')) var version = require('../package.json').version -test('misc - prints usage', function (t) { +test('usage - prints usage', function (t) { var d = spawn(t, dat) d.stderr.match(function (output) { var usage = output.indexOf('Usage') > -1 @@ -15,7 +15,7 @@ test('misc - prints usage', function (t) { d.end() }) -test('misc - prints version', function (t) { +test('usage - prints version', function (t) { var d = spawn(t, dat + ' -v') d.stderr.match(function (output) { var ver = output.indexOf(version) > -1 @@ -25,7 +25,7 @@ test('misc - prints version', function (t) { d.end() }) -test('misc - also prints version', function (t) { +test('usage - also prints version', function (t) { var d = spawn(t, dat + ' -v') d.stderr.match(function (output) { var ver = output.indexOf(version) > -1 @@ -34,3 +34,13 @@ test('misc - also prints version', function (t) { }) d.end() }) + +test('usage - help prints usage', function (t) { + var d = spawn(t, dat + ' help') + d.stderr.match(function (output) { + var usage = output.indexOf('Usage') > -1 + if (!usage) return false + return true + }) + d.end() +})