2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-11 07:41:04 +00:00

Validation of url should trigger after the check for the required arguments

This commit is contained in:
Jia Hao 2015-07-05 15:10:36 +08:00
parent 0939715017
commit debc395599

15
cli.js
View File

@ -17,23 +17,24 @@ if (protocolSchemes && protocolNames && protocolNames.length === protocolSchemes
}) })
} }
if (!validator.isURL(args.target)) {
console.error('Enter a valid target url');
process.exit(1);
}
if (!args.dir || !args.name || !args.version || !args.target || (!args.all && (!args.platform || !args.arch))) { if (!args.dir || !args.name || !args.version || !args.target || (!args.all && (!args.platform || !args.arch))) {
console.error(usage); console.error(usage);
process.exit(1); process.exit(1);
} }
if (!validator.isURL(args.target)) {
console.error('Enter a valid target url');
process.exit(1);
}
// writes parameters for the app into a text file
// I'm not exactly sure how to pass these as an argument through code
var appArgs = { var appArgs = {
name: args.name, name: args.name,
targetUrl: args.target targetUrl: args.target
}; };
fs.writeFileSync('./app/targetUrl.txt', JSON.stringify(appArgs)); fs.writeFileSync('./app/targetUrl.txt', JSON.stringify(appArgs));