From e85724693487e3f28fad36e031f4aa9b795bd642 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Mon, 2 Feb 2015 03:39:46 -0800 Subject: [PATCH] Improve command line argument handlings. #188 --- src/client.d | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/client.d b/src/client.d index f1904ff..13f28a0 100644 --- a/src/client.d +++ b/src/client.d @@ -56,15 +56,15 @@ int main(string[] args) "doc|d", &doc, "query|q", &query, "search|s", &search, "version", &printVersion); } - catch (Exception e) + catch (ConvException e) { Log.fatal(e.msg); + printHelp(args[0]); return 1; } AutocompleteRequest request; - if (printVersion) { version (Windows) @@ -155,6 +155,11 @@ int main(string[] args) } else { + if (!exists(args[1])) + { + stderr.writeln("Could not find ", args[1]); + return 1; + } File f = File(args[1]); sourceCode = uninitializedArray!(ubyte[])(to!size_t(f.size)); f.rawRead(sourceCode);