Skip to content

Commit

Permalink
Merge pull request noppoMan#17 from noppoMan/add_dropTable_to_npdcli
Browse files Browse the repository at this point in the history
Add dropTable command to npdcli
  • Loading branch information
noppoMan committed Jul 19, 2015
2 parents d4f728c + e2e6e77 commit eca18d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ npd migrate:rollback
* `dump <table>`: Dump amount of records in specified table to stdout.
* `desc <table>`: Show result of the describe operation
* `get <table> <hashKey> [rangeKey]`: Show results of the query operation by given conditions.
* `dropTable <table>`: Drop the specified table.

### Global Options
* `-h`
Expand Down
12 changes: 12 additions & 0 deletions lib/bin/npd
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,18 @@ function initialize(){
}).catch(exitWithError);
});

program
.command('dropTable <table>')
.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) {
Expand Down

0 comments on commit eca18d5

Please sign in to comment.