From 607822ac91b0a7ea4ffa6e65d156b702c898f505 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Wed, 6 Jul 2022 20:06:22 +0200
Subject: [PATCH] chore: commit save point

---
 .idea/runConfigurations/document___help.xml   | 12 +++++++
 .idea/runConfigurations/document_add.xml      | 15 ++++++++
 .../runConfigurations/document_add___help.xml | 12 +++++++
 .idea/runConfigurations/server.xml            | 12 +++++++
 .idea/runConfigurations/server_serve.xml      | 12 +++++++
 .idea/runConfigurations/version.xml           | 12 +++++++
 Makefile                                      |  2 +-
 application/source/commands/02_command.go     |  4 +++
 application/source/commands/06_definitions.go |  1 +
 application/source/commands/08_document.go    |  4 ++-
 application/source/commands/09_server.go      | 28 +++++++++++++++
 .../source/commands/09_server_serve.go        | 35 +++++++++++++++++++
 12 files changed, 147 insertions(+), 2 deletions(-)
 create mode 100644 .idea/runConfigurations/document___help.xml
 create mode 100644 .idea/runConfigurations/document_add.xml
 create mode 100644 .idea/runConfigurations/document_add___help.xml
 create mode 100644 .idea/runConfigurations/server.xml
 create mode 100644 .idea/runConfigurations/server_serve.xml
 create mode 100644 .idea/runConfigurations/version.xml
 create mode 100644 application/source/commands/09_server.go
 create mode 100644 application/source/commands/09_server_serve.go

diff --git a/.idea/runConfigurations/document___help.xml b/.idea/runConfigurations/document___help.xml
new file mode 100644
index 0000000..16fc6fe
--- /dev/null
+++ b/.idea/runConfigurations/document___help.xml
@@ -0,0 +1,12 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="document --help" type="GoApplicationRunConfiguration" factoryName="Go Application">
+    <module name="documentation-manager" />
+    <working_directory value="$PROJECT_DIR$" />
+    <parameters value="document --help" />
+    <kind value="DIRECTORY" />
+    <directory value="$PROJECT_DIR$/application/source" />
+    <filePath value="$PROJECT_DIR$" />
+    <output_directory value="$PROJECT_DIR$/deployment/build" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.idea/runConfigurations/document_add.xml b/.idea/runConfigurations/document_add.xml
new file mode 100644
index 0000000..c065111
--- /dev/null
+++ b/.idea/runConfigurations/document_add.xml
@@ -0,0 +1,15 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="document add" type="GoApplicationRunConfiguration" factoryName="Go Application">
+    <module name="documentation-manager" />
+    <working_directory value="$PROJECT_DIR$/development/examples/example1" />
+    <parameters value="document add newdoc1 newdow2 newdoc3" />
+    <envs>
+      <env name="DOCMAN_PATH" value="dsfsdfsdfsdfsdfsdf" />
+    </envs>
+    <kind value="DIRECTORY" />
+    <directory value="$PROJECT_DIR$/application/source" />
+    <filePath value="$PROJECT_DIR$" />
+    <output_directory value="$PROJECT_DIR$/deployment/build" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.idea/runConfigurations/document_add___help.xml b/.idea/runConfigurations/document_add___help.xml
new file mode 100644
index 0000000..5adc1e1
--- /dev/null
+++ b/.idea/runConfigurations/document_add___help.xml
@@ -0,0 +1,12 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="document add --help" type="GoApplicationRunConfiguration" factoryName="Go Application">
+    <module name="documentation-manager" />
+    <working_directory value="$PROJECT_DIR$" />
+    <parameters value="document add --help" />
+    <kind value="DIRECTORY" />
+    <directory value="$PROJECT_DIR$/application/source" />
+    <filePath value="$PROJECT_DIR$" />
+    <output_directory value="$PROJECT_DIR$/deployment/build" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.idea/runConfigurations/server.xml b/.idea/runConfigurations/server.xml
new file mode 100644
index 0000000..f3419e2
--- /dev/null
+++ b/.idea/runConfigurations/server.xml
@@ -0,0 +1,12 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="server" type="GoApplicationRunConfiguration" factoryName="Go Application">
+    <module name="documentation-manager" />
+    <working_directory value="$PROJECT_DIR$/development/examples/example1" />
+    <parameters value="server" />
+    <kind value="DIRECTORY" />
+    <directory value="$PROJECT_DIR$/application/source" />
+    <filePath value="$PROJECT_DIR$" />
+    <output_directory value="$PROJECT_DIR$/deployment/build" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.idea/runConfigurations/server_serve.xml b/.idea/runConfigurations/server_serve.xml
new file mode 100644
index 0000000..f4e7bd7
--- /dev/null
+++ b/.idea/runConfigurations/server_serve.xml
@@ -0,0 +1,12 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="server serve" type="GoApplicationRunConfiguration" factoryName="Go Application">
+    <module name="documentation-manager" />
+    <working_directory value="$PROJECT_DIR$/development/examples/example1" />
+    <parameters value="server serve" />
+    <kind value="DIRECTORY" />
+    <directory value="$PROJECT_DIR$/application/source" />
+    <filePath value="$PROJECT_DIR$" />
+    <output_directory value="$PROJECT_DIR$/deployment/build" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.idea/runConfigurations/version.xml b/.idea/runConfigurations/version.xml
new file mode 100644
index 0000000..f99562c
--- /dev/null
+++ b/.idea/runConfigurations/version.xml
@@ -0,0 +1,12 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="version" type="GoApplicationRunConfiguration" factoryName="Go Application">
+    <module name="documentation-manager" />
+    <working_directory value="$PROJECT_DIR$" />
+    <parameters value="version" />
+    <kind value="DIRECTORY" />
+    <directory value="$PROJECT_DIR$/application/source" />
+    <filePath value="$PROJECT_DIR$" />
+    <output_directory value="$PROJECT_DIR$/deployment/build" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 563b687..ce86bbe 100644
--- a/Makefile
+++ b/Makefile
@@ -71,7 +71,7 @@ $(CATALOGFILES): $(LOCALEFILES) $(GOFILES)
 	$(QUIET) touch $(CATALOGFILES) $(LOCALEFILES) 
 
 .PHONY: build-locales
-# Generate the catalog files	
+## Generate the catalog files	
 build-locales: $(CATALOGFILES)
 	
 
diff --git a/application/source/commands/02_command.go b/application/source/commands/02_command.go
index b65ea84..55010e3 100644
--- a/application/source/commands/02_command.go
+++ b/application/source/commands/02_command.go
@@ -17,6 +17,10 @@ func initCommands() {
 			if i == 0 {
 				c = state.parser.Find(y)
 			} else {
+				if c == nil {
+					exitWithError(1, "Command %s not found", y)
+				}
+
 				c = c.Find(y)
 			}
 
diff --git a/application/source/commands/06_definitions.go b/application/source/commands/06_definitions.go
index f1adaa0..eaa8c83 100644
--- a/application/source/commands/06_definitions.go
+++ b/application/source/commands/06_definitions.go
@@ -4,4 +4,5 @@ type Definition struct {
 	ConfigurationPath string             `long:"config" short:"c"`
 	Version           VersionDefinition  `command:"version" alias:"v"`
 	Document          DocumentDefinition `command:"document" alias:"d"`
+	Server            ServerDefinition   `command:"server" alias:"s"`
 }
diff --git a/application/source/commands/08_document.go b/application/source/commands/08_document.go
index 9b66add..f8c5847 100644
--- a/application/source/commands/08_document.go
+++ b/application/source/commands/08_document.go
@@ -5,13 +5,15 @@ import (
 	"gitlab.schukai.com/oss/utilities/documentation-manager/translations"
 )
 
+const documentSymbol = "document"
+
 func init() {
 
 	h := handler{
 		init: initDocument,
 	}
 
-	handlers.executor["document"] = h
+	handlers.executor[documentSymbol] = h
 
 }
 
diff --git a/application/source/commands/09_server.go b/application/source/commands/09_server.go
new file mode 100644
index 0000000..d102c31
--- /dev/null
+++ b/application/source/commands/09_server.go
@@ -0,0 +1,28 @@
+package commands
+
+import (
+	"github.com/jessevdk/go-flags"
+	"gitlab.schukai.com/oss/utilities/documentation-manager/translations"
+)
+
+const serverSymbol = "server"
+
+func init() {
+
+	h := handler{
+		init: initServer,
+	}
+
+	handlers.executor[serverSymbol] = h
+
+}
+
+type ServerDefinition struct {
+	Serve ServerServeDefinition `command:"serve" alias:"s"`
+}
+
+func initServer(command *flags.Command) {
+	const text = "Server command"
+	command.ShortDescription = translations.T.Sprintf(text)
+	command.LongDescription = translations.T.Sprintf(text)
+}
diff --git a/application/source/commands/09_server_serve.go b/application/source/commands/09_server_serve.go
new file mode 100644
index 0000000..92b123d
--- /dev/null
+++ b/application/source/commands/09_server_serve.go
@@ -0,0 +1,35 @@
+package commands
+
+import (
+	"fmt"
+	"github.com/jessevdk/go-flags"
+	"gitlab.schukai.com/oss/utilities/documentation-manager/translations"
+)
+
+const serverServeSymbol = "server-serve"
+
+func init() {
+
+	h := handler{
+		init:    initServerServe,
+		execute: runServerServe,
+	}
+
+	handlers.executor[serverServeSymbol] = h
+
+}
+
+type ServerServeDefinition struct {
+}
+
+func initServerServe(command *flags.Command) {
+	const text = "Server command"
+	command.ShortDescription = translations.T.Sprintf(text)
+	command.LongDescription = translations.T.Sprintf(text)
+}
+
+func runServerServe(command *flags.Command) {
+
+	fmt.Println("Server command")
+
+}
-- 
GitLab