Navigation Menu

Skip to content

Commit

Permalink
Add "--force" option to delete index field and use it from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 27, 2012
1 parent 1280c55 commit 7767e02
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
25 changes: 16 additions & 9 deletions bin/gcs-configure-fields
Expand Up @@ -46,15 +46,22 @@ if (commandLine.options.delete) {
console.log('You must specify an existing field.');
return process.exit(1);
}
commandLine.confirm('Really delete? [' + field.name + '] (y/N) ', function(ok){
if (ok) {
field.deleteSync();
console.log('Updated 1 Index Field:');
process.exit(0);
} else {
process.exit(1);
}
});
var doDelete = function() {
field.deleteSync();
console.log('Updated 1 Index Field:');
};
if (commandLine.options.force) {
doDelete();
} else {
commandLine.confirm('Really delete? [' + field.name + '] (y/N) ', function(ok){
if (ok) {
doDelete();
process.exit(0);
} else {
process.exit(1);
}
});
}
} else {
if (!field.exists()) {
if (!commandLine.options.type) {
Expand Down
2 changes: 2 additions & 0 deletions test/gcs-commands.test.js
Expand Up @@ -340,6 +340,7 @@ suite('gcs-configure-fields', function() {
'--domain-name', 'companies',
'--name', name,
'--delete',
'--force',
'--database-path', temporaryDatabase.path)
.next(function(result) {
assert.deepEqual({ code: result.code,
Expand Down Expand Up @@ -411,6 +412,7 @@ suite('gcs-configure-fields', function() {
'--domain-name', 'companies',
'--name', 'name',
'--delete',
'--force',
'--database-path', temporaryDatabase.path)
.next(function(result) {
assert.deepEqual({ code: result.code,
Expand Down

0 comments on commit 7767e02

Please sign in to comment.