From 4a967b126bfcfa72f32e33ace95ea4a66d1c64dd Mon Sep 17 00:00:00 2001 From: Scott Lowe Date: Fri, 1 Nov 2019 14:45:45 +0100 Subject: [PATCH] Fix warnings when executing CLI without arguments. Change-type: patch Signed-off-by: Scott Lowe --- lib/app-capitano.coffee | 4 ++-- tests/commands/help.spec.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/app-capitano.coffee b/lib/app-capitano.coffee index 0b04150e..6d86b0c9 100644 --- a/lib/app-capitano.coffee +++ b/lib/app-capitano.coffee @@ -25,8 +25,8 @@ capitano.permission 'user', (done) -> capitano.command signature: '*' - action: -> - capitano.execute(command: 'help') + action: (params, options, done) -> + capitano.execute(command: 'help', done) capitano.globalOption signature: 'help' diff --git a/tests/commands/help.spec.ts b/tests/commands/help.spec.ts index 98505017..4f8a0db8 100644 --- a/tests/commands/help.spec.ts +++ b/tests/commands/help.spec.ts @@ -134,4 +134,20 @@ describe('balena help', function() { chai.expect(err.join('')).to.equal(''); }); + + it('should print simple help text when no arguments present', async () => { + const { out, err } = await runCommand(''); + + chai + .expect(cleanOutput(out)) + .to.deep.equal( + cleanOutput([ + SIMPLE_HELP, + 'Run `balena help --verbose` to list additional commands', + GLOBAL_OPTIONS, + ]), + ); + + chai.expect(err.join('')).to.equal(''); + }); });