From 756b2a05304ad6d53af05e3a4ff2b0bbd3713a95 Mon Sep 17 00:00:00 2001
From: Rusty Russell <rusty@rustcorp.com.au>
Date: Wed, 4 Jan 2017 14:04:15 +1030
Subject: [PATCH] options: --help and --version are early args.

If they use these, we definitely don't want to create the config dir...

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 daemon/options.c | 8 ++++----
 version.h        | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/daemon/options.c b/daemon/options.c
index aaf0f0c35..8ef278409 100644
--- a/daemon/options.c
+++ b/daemon/options.c
@@ -453,10 +453,10 @@ bool handle_opts(struct lightningd_state *dstate, int argc, char *argv[])
 
 	opt_set_alloc(opt_allocfn, tal_reallocfn, tal_freefn);
 
-	opt_register_noarg("--help|-h", opt_usage_and_exit,
-			   "\n"
-			   "A bitcoin lightning daemon.",
-			   "Print this message.");
+	opt_register_early_noarg("--help|-h", opt_usage_and_exit,
+				 "\n"
+				 "A bitcoin lightning daemon.",
+				 "Print this message.");
 	opt_register_arg("--port", opt_set_u16, opt_show_u16, &dstate->portnum,
 			 "Port to bind to (0 means don't listen)");
 	opt_register_arg("--bitcoin-datadir", opt_set_charp, NULL,
diff --git a/version.h b/version.h
index 36f358eb7..921115eea 100644
--- a/version.h
+++ b/version.h
@@ -7,7 +7,7 @@ char *version_and_exit(const void *unused);
 const char *version(void);
 
 #define opt_register_version()						\
-	opt_register_noarg("--version|-V", version_and_exit, NULL,	\
-			   "print version to standard output and exit")
+	opt_register_early_noarg("--version|-V", version_and_exit, NULL, \
+				 "print version to standard output and exit")
 
 #endif /* LIGHTNING_VERSION_H */