From 3e17bfb54c3d050ecd56ae2853e75002017c9958 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch <p.janouch@gmail.com>
Date: Thu, 9 Jul 2015 23:55:41 +0200
Subject: degesch: add a first time help

---
 degesch.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/degesch.c b/degesch.c
index f4fc87c..378b12f 100644
--- a/degesch.c
+++ b/degesch.c
@@ -8570,6 +8570,34 @@ end:
 	return root;
 }
 
+static const char *g_first_time_help[] =
+{
+	"",
+	"\x02Welcome to degesch!",
+	"",
+	"To get a list of all commands, type \x02/help\x0f.  To obtain",
+	"more information on a command or option, simply add it as",
+	"a parameter, e.g. \x02/help set\x0f or \x02/help behaviour.logging\x0f.",
+	"",
+	"To switch between buffers, press \x02"
+		"F5/Ctrl-P\x0f or \x02" "F6/Ctrl-N\x0f.",
+	"",
+	"Finally, adding a network is as simple as:",
+	" - \x02/server add freenode\x0f",
+	" - \x02/set servers.freenode.addresses = \"chat.freenode.net\"\x0f",
+	" - \x02/connect freenode\x0f",
+	"",
+	"That should be enough to get you started.  Have fun!",
+	""
+};
+
+static void
+show_first_time_help (struct app_context *ctx)
+{
+	for (size_t i = 0; i < N_ELEMENTS (g_first_time_help); i++)
+		log_global_indent (ctx, "#m", g_first_time_help[i]);
+}
+
 static void
 load_configuration (struct app_context *ctx)
 {
@@ -8588,6 +8616,7 @@ load_configuration (struct app_context *ctx)
 		log_global_error (ctx, "#s", e->message);
 		error_free (e);
 	}
+
 	if (root)
 	{
 		config_item_destroy (ctx->config.root);
@@ -8595,6 +8624,10 @@ load_configuration (struct app_context *ctx)
 		config_load (&ctx->config, root);
 		log_global_status (ctx, "Configuration loaded");
 	}
+	else
+	{
+		show_first_time_help (ctx);
+	}
 }
 
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- 
cgit v1.2.3-70-g09d2