From ed71d9d362f3a930d769ec2ffa39ace2490701e4 Mon Sep 17 00:00:00 2001 From: Eric Jiang Date: Tue, 20 Nov 2018 12:49:49 -0500 Subject: [PATCH] feat(): show help if command provided is not valid --- bin/afs-add | 2 ++ bin/afs-commit | 2 ++ bin/afs-create | 2 ++ bin/afs-deploy | 2 ++ bin/afs-destroy | 2 ++ bin/afs-history | 2 ++ bin/afs-metadata | 7 ++----- bin/afs-ownership | 5 ++--- bin/afs-price | 3 ++- bin/afs-remove | 2 ++ bin/afs-unarchive | 2 ++ 11 files changed, 22 insertions(+), 9 deletions(-) diff --git a/bin/afs-add b/bin/afs-add index bcf0d02..d05331f 100755 --- a/bin/afs-add +++ b/bin/afs-add @@ -27,6 +27,8 @@ const { argv } = program }) }, onadd) .help('h') + .recommendCommands() + .strict() async function onadd(argv) { const [ ...paths ] = argv.pathspec diff --git a/bin/afs-commit b/bin/afs-commit index 9941f38..4e16c65 100755 --- a/bin/afs-commit +++ b/bin/afs-commit @@ -38,6 +38,8 @@ const { argv } = program }) }, oncommit) .help('h') + .recommendCommands() + .strict() async function oncommit(argv) { const { diff --git a/bin/afs-create b/bin/afs-create index 23a0d62..1e76e34 100755 --- a/bin/afs-create +++ b/bin/afs-create @@ -40,6 +40,8 @@ const { argv } = program }) }, oncreate) .help('h') + .recommendCommands() + .strict() async function oncreate(argv) { let { owner } = argv diff --git a/bin/afs-deploy b/bin/afs-deploy index 9218520..bf51bb6 100755 --- a/bin/afs-deploy +++ b/bin/afs-deploy @@ -33,6 +33,8 @@ const { argv } = program }) }, ondeploy) .help('h') + .recommendCommands() + .strict() async function ondeploy(argv) { const { diff --git a/bin/afs-destroy b/bin/afs-destroy index b6f8d6d..6687026 100755 --- a/bin/afs-destroy +++ b/bin/afs-destroy @@ -35,6 +35,8 @@ const { argv } = program }) }, ondestroy) .help('h') + .recommendCommands() + .strict() async function ondestroy(argv) { const { diff --git a/bin/afs-history b/bin/afs-history index d84854a..0bcbbfc 100755 --- a/bin/afs-history +++ b/bin/afs-history @@ -26,6 +26,8 @@ const { argv } = program }) }, onhistory) .help('h') + .recommendCommands() + .strict() async function onhistory(argv) { let { did } = argv diff --git a/bin/afs-metadata b/bin/afs-metadata index 6bd31af..1fcefec 100755 --- a/bin/afs-metadata +++ b/bin/afs-metadata @@ -36,7 +36,6 @@ const { argv } = program describe: 'Print full metadata after write' }) }, onmetadatawritekey) - .help('h') .command('read-key ', "Read a key's value from AFS metadata", (_) => { _ .positional('did', { @@ -48,7 +47,6 @@ const { argv } = program describe: 'The key to write' }) }, onmetadatareadkey) - .help('h') .command('delete-key ', "Delete a key-value pair from the AFS' metadata file", (_) => { _ .positional('did', { @@ -65,7 +63,6 @@ const { argv } = program describe: 'Print full metadata after delete' }) }, onmetadatadeletekey) - .help('h') .command('clear ', 'Clears all metadata from an AFS', (_) => { _ .positional('did', { @@ -73,7 +70,6 @@ const { argv } = program describe: 'An AFS ARA decentralized identity (did) URI' }) }, onmetadataclear) - .help('h') .command('print ', 'Prints current metadata for an AFS', (_) => { _ .positional('did', { @@ -81,7 +77,6 @@ const { argv } = program describe: 'An AFS ARA decentralized identity (did) URI' }) }, onmetadataprint) - .help('h') .command('write-file ', 'Writes contents of entire file to metadata', (_) => { _ .positional('did', { @@ -90,6 +85,8 @@ const { argv } = program }) }, onmetadatawritefile) .help('h') + .recommendCommands() + .strict() async function onmetadatawritekey(argv) { const { diff --git a/bin/afs-ownership b/bin/afs-ownership index 490c5ce..910c198 100755 --- a/bin/afs-ownership +++ b/bin/afs-ownership @@ -32,7 +32,6 @@ const { argv } = program describe: 'An AFS ARA decentralized identity (did) URI' }) }, onrequestownership) - .help('h') .command('revoke ', 'Revokes a previous request for ownership of an AFS', (_) => { _ .positional('requester-did', { @@ -44,7 +43,6 @@ const { argv } = program describe: 'An AFS ARA decentralized identity (did) URI' }) }, onrevokerequest) - .help('h') .command('approve ', 'Approves an ownership transfer', (_) => { _ .positional('content-did', { @@ -56,7 +54,6 @@ const { argv } = program describe: 'DID to transfer ownership to' }) }, onapprovetransfer) - .help('h') .command('claim ', "Claim an AFS' identity", (_) => { _ .positional('content-did', { @@ -65,6 +62,8 @@ const { argv } = program }) }, onclaimownership) .help('h') + .recommendCommands() + .strict() async function onrequestownership(argv) { const { diff --git a/bin/afs-price b/bin/afs-price index db437f4..014f938 100755 --- a/bin/afs-price +++ b/bin/afs-price @@ -36,7 +36,6 @@ const { argv } = program describe: 'Force set price operation', }) }, onsetprice) - .help('h') .command('get ', 'Return the price for a given AFS', (_) => { _ .positional('did', { @@ -45,6 +44,8 @@ const { argv } = program }) }, ongetprice) .help('h') + .recommendCommands() + .strict() async function onsetprice(argv) { const { did } = argv diff --git a/bin/afs-remove b/bin/afs-remove index 4039427..e6b2053 100755 --- a/bin/afs-remove +++ b/bin/afs-remove @@ -27,6 +27,8 @@ const { argv } = program }) }, onremove) .help('h') + .recommendCommands() + .strict() async function onremove(argv) { const [ ...paths ] = argv.pathspec diff --git a/bin/afs-unarchive b/bin/afs-unarchive index afc71a7..476eef2 100755 --- a/bin/afs-unarchive +++ b/bin/afs-unarchive @@ -27,6 +27,8 @@ const { argv } = program }) }, onunarchive) .help('h') + .recommendCommands() + .strict() async function onunarchive(argv) { const {