From 7530c950e3cf5379b9d7f675a31833497ae8d576 Mon Sep 17 00:00:00 2001
From: rabuzarus <>
Date: Sat, 26 Dec 2015 16:06:38 +0100
Subject: [PATCH] help - make use of subfolders

---
 boot.php     | 12 ++++++++++++
 mod/help.php | 12 ++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/boot.php b/boot.php
index bd2bee3ab..a51b7a42b 100644
--- a/boot.php
+++ b/boot.php
@@ -1960,3 +1960,15 @@ function current_load() {
 
 	return max($load_arr);
 }
+
+// much better way of dealing with c-style args
+function argc() {
+	return get_app()->argc;
+}
+
+function argv($x) {
+	if(array_key_exists($x,get_app()->argv))
+		return get_app()->argv[$x];
+
+	return '';
+}
diff --git a/mod/help.php b/mod/help.php
index 6d8fbb184..ebade07ea 100644
--- a/mod/help.php
+++ b/mod/help.php
@@ -27,8 +27,16 @@ function help_content(&$a) {
 	$text = '';
 
 	if ($a->argc > 1) {
-		$text = load_doc_file('doc/' . $a->argv[1] . '.md');
-		$a->page['title'] = t('Help:') . ' ' . str_replace('-', ' ', notags($a->argv[1]));
+		$path = '';
+		for($x = 1; $x < argc(); $x ++) {
+			if(strlen($path))
+				$path .= '/';
+			$path .= argv($x);
+		}
+		$title = basename($path);
+
+		$text = load_doc_file('doc/' . $path . '.md');
+		$a->page['title'] = t('Help:') . ' ' . str_replace('-', ' ', notags($title));
 	}
 	$home = load_doc_file('doc/Home.md');
 	if (!$text) {