Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| var program = require('commander'); | ||
| var commandLine = require(__dirname + '/../lib/command-line'); | ||
|
|
||
| program | ||
| .version(require('../package').version) | ||
| .usage('--domain-name <domain name> [options]') | ||
| .option('-d, --domain-name <domain name>', | ||
| 'The name of the domain that you are deleting. Required.', | ||
| String) | ||
| .option('-f, --force', | ||
| 'Delete the domain without prompting for confirmation.') | ||
| .option('--database-path <path>', | ||
| 'database path [' + commandLine.defaultDatabasePath + ']', | ||
| String, | ||
| commandLine.defaultDatabasePath) | ||
| .parse(process.argv); | ||
|
|
||
| if (!program.domainName) { | ||
| console.log('You must specify the domain name.'); | ||
| return process.exit(1); | ||
| } | ||
|
|
||
| var context = commandLine.getContext(program.databasePath); | ||
| var domain = new commandLine.Domain(program.domainName, context); | ||
| if (!domain.exists()) { | ||
| console.log('You must specify an existing domain name.'); | ||
| return process.exit(1); | ||
| } | ||
|
|
||
| if (program.force) { | ||
| domain.deleteSync(); | ||
| console.log('Domain [' + domain.name + '] has been deleted successfully.'); | ||
| } else { | ||
| program.confirm('Really delete? [' + domain.name + '] (y/N)', function(ok){ | ||
| if (ok) { | ||
| domain.deleteSync(); | ||
| console.log('Successfully deleted.'); | ||
| process.exit(0); | ||
| } else { | ||
| process.exit(1); | ||
| } | ||
| }); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters