The guide-list.txt uses exactly the same format as command-list.txt
so could be merged as part of a refactoring.

The category naming for each guide is an initial suggestion and
is not yet used. Only those with the 'guide' prefix are copied
by the generate-guidelist.sh into the common-guides.h file.

The user-manual.txt and everyday.txt do not have the correct filename
format yet. And gitrepository-layout.txt name is too long to include.
So comment them out.

Signed-off-by: Philip Oakley <philipoak...@iee.org>
---
The shell script function N_() does not appear to work correctly on my
Ubuntu lash-up, so an simpler script line is used with the original
commented out.
---
 generate-guidelist.sh | 23 +++++++++++++++++++++++
 guide-list.txt        | 29 +++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 generate-guidelist.sh
 create mode 100644 guide-list.txt

diff --git a/generate-guidelist.sh b/generate-guidelist.sh
new file mode 100644
index 0000000..c0c98eb
--- /dev/null
+++ b/generate-guidelist.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Usage: ./generate-guidelist.sh  >>common-guides.h
+# based on generate-cmdlist.sh
+echo "/* Automatically generated by $0 */
+/* re-use struct cmdname_help in common-commands.h */
+
+static struct cmdname_help common_guides[] = {"
+
+sed -n -e 's/^git\([^  ]*\)[   ].* guide.*/\1/p' guide-list.txt |
+sort |
+while read guide
+do
+     sed -n '
+     /^NAME/,/git'"$guide"'/H
+     ${
+           x
+#          s/.*git'"$guide"' - \(.*\)/  {"'"$guide"'", N_("\1")},/
+           s/.*git'"$guide"' - \(.*\)/  {"'"$guide"'", "\1"},/
+           p
+     }' "Documentation/git$guide.txt"
+done
+echo "};"
+
diff --git a/guide-list.txt b/guide-list.txt
new file mode 100644
index 0000000..a419ac4
--- /dev/null
+++ b/guide-list.txt
@@ -0,0 +1,29 @@
+# List of known git guides.
+# guide name                           category [deprecated] [common] [guide]
+gitattributes                           concept         guide
+gitcore-tutorial                        specialist
+gitcredentials                          specialist
+gitcvs-migration                        specialist
+gitdiffcore                             specialist
+gitglossary                             reference       guide
+githooks                                specialist
+gitignore                               concept         guide
+gitmodules                              concept         guide
+gitnamespaces                           specialist
+#gitrepository-layout                    reference guide
+gitrevisions                            concept         guide
+gittutorial                             user    guide
+gittutorial-2                           user
+gitweb.conf                             specialist
+gitweb                                  specialist
+gitworkflows                            user    guide
+
+#giteveryday                             user   guide
+#gituser-manual                          user   guide
+
+# could embed inside common-cmds.h with [guide] as the second thing,
+# making the sed's in generate-cmdlist.sh more obvious
+# but drop the dash in 's/^git-\
+
+#gitrepository-layout is too long for the current char[16]
+#
-- 
1.8.1.msysgit.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to