Browse Source

command-line options override defaults

master
Lloyd Brookes 11 years ago
parent
commit
8abb8a5ce1
  1. 10
      ws.js

10
ws.js

@ -36,11 +36,10 @@ var argv = new Thing()
.define({ name: "compress", alias: "c", type: "boolean" })
.on("error", function(err){
halt(err.message);
})
.set(process.argv);
});
/*
Include any options from "package.json", ".local-web-server.json" or "~/.local-web-server.json", in that order
Set default options from "package.json", ".local-web-server.json" or "~/.local-web-server.json", in that order
*/
var pkgPath = path.join(process.cwd(), "package.json"),
lwsPath = path.join(process.cwd(), ".local-web-server.json"),
@ -55,6 +54,11 @@ if (fs.existsSync(homePath)){
argv.set(require(homePath));
}
/*
Finally, set the options from the command-line, overriding all defaults.
*/
argv.set(process.argv);
/**
Die here if invalid args received
*/

Loading…
Cancel
Save