commit 579b30bee4a95ada714307b667fb547d95051ed8
parent 2098b60762c69fce81579193210a55167d43b2b6
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Thu, 1 May 2014 22:28:56 +0200
Allow passing domains as arguments (Closes #1)
Diffstat:
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/bin/dnc b/bin/dnc
@@ -6,7 +6,7 @@
/* https://github.com/fcambus/dnc */
/* */
/* Created: 2014/02/11 */
-/* Last Updated: 2014/02/21 */
+/* Last Updated: 2014/05/01 */
/* */
/* dnc is released under the BSD 2-Clause license. */
/* See LICENSE file for details. */
@@ -21,12 +21,19 @@ var config = require("../config.json");
log.info("", "dnc is running. Press Ctrl+C to stop");
-fs.readFile(process.env.HOME + '/.dnc', function(error, data) {
- if (!error) {
- config = JSON.parse(data);
- } else {
- log.warn("", "Can't read ~/.dnc file, using default configuration");
- }
+
+if (process.argv.length != 2) {
+ config.domains = process.argv.splice(2, process.argv.length);
dnc(config);
-});
+} else {
+ fs.readFile(process.env.HOME + '/.dnc', function(error, data) {
+ if (!error) {
+ config = JSON.parse(data);
+ } else {
+ log.warn("", "Can't read ~/.dnc file, using default configuration");
+ }
+
+ dnc(config);
+ });
+}
diff --git a/package.json b/package.json
@@ -1,7 +1,7 @@
{
"name": "dnc",
"version": "0.1.1",
- "description": "A tool to check domain names configuration and statistics",
+ "description": "A CLI tool to check domain names configuration and statistics",
"main": "index.js",
"preferGlobal": "true",
"bin": {