From e2e6e773bf819a3f021bc143d04010d2bcd97bf2 Mon Sep 17 00:00:00 2001 From: noppoman Date: Sun, 19 Jul 2015 22:54:37 +0900 Subject: [PATCH] Add dropTable command to npdcli --- README.md | 1 + lib/bin/npd | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index ec6fa38..584c888 100644 --- a/README.md +++ b/README.md @@ -602,6 +602,7 @@ npd migrate:rollback * `dump `: Dump amount of records in specified table to stdout. * `desc
`: Show result of the describe operation * `get
[rangeKey]`: Show results of the query operation by given conditions. +* `dropTable
`: Drop the specified table. ### Global Options * `-h` diff --git a/lib/bin/npd b/lib/bin/npd index b9de22c..fbfe937 100755 --- a/lib/bin/npd +++ b/lib/bin/npd @@ -259,6 +259,18 @@ function initialize(){ }).catch(exitWithError); }); + program + .command('dropTable
') + .description(' Drop the specified table.') + .action(function(table, hashKey, rangeKey) { + return initCli().then(function(config){ + var npd = npdynamod.createClient(config.dynamoClient); + return npd().table(table).deleteTable().then(function(result){ + exit(inspect(result)); + }); + }).catch(exitWithError); + }); + program.parse(process.argv); if(argv._.length === 0 || !_.last(program.args)._name) {