From 3129bb304d5d388365862900564af66d22fe01a8 Mon Sep 17 00:00:00 2001 From: Paul Fenwick Date: Sun, 12 Oct 2014 14:47:50 +1100 Subject: [PATCH] Display help when called with no options. --- CKAN/CKAN/Program.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CKAN/CKAN/Program.cs b/CKAN/CKAN/Program.cs index 8a2bef2eed..3927d09062 100644 --- a/CKAN/CKAN/Program.cs +++ b/CKAN/CKAN/Program.cs @@ -33,15 +33,14 @@ public static int Main (string[] args) { Options cmdline; - // If called with no arguments, the parser throws an exception. - // TODO: It would be nice if we just *displayed* the help here, - // rather than asking the user to try --help. - try { cmdline = new Options (args); } catch (NullReferenceException) { - Console.WriteLine ("Try ckan --help"); + // Oops, something went wrong. Generate the help screen instead! + + string[] help = { "--help" }; // Is there a nicer way than a temp var? + new Options ( help ); return EXIT_BADOPT; }