diff --git a/.idea/runConfigurations/document___help.xml b/.idea/runConfigurations/document___help.xml new file mode 100644 index 0000000000000000000000000000000000000000..16fc6fe9a7f3fd79c00a3ecb97864fac77825fe6 --- /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 0000000000000000000000000000000000000000..c06511177514b29197b18f94f72b74853ae883da --- /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 0000000000000000000000000000000000000000..5adc1e11dbc87ce0ac263c9eb371faa113ca315c --- /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 0000000000000000000000000000000000000000..f3419e2eb5ec2eeb710c04f448ab347043587bf3 --- /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 0000000000000000000000000000000000000000..f4e7bd78aa4562871362bb8c13b6faebcc9cce64 --- /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 0000000000000000000000000000000000000000..f99562c169c5a4acbf791474cf7836b1788c2332 --- /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 563b687468900f68f71b7aeae5c37d6aa48286f8..ce86bbe76231705422affebffc2ef4eb7596fab8 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 b65ea84e0c71c2bd8c36b93facfe5f6e37c2d010..55010e3e75d20a932a3ad2a7050b951ffeca931e 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 f1adaa04aa264ff52101c224922156dd408d7379..eaa8c83898d8ac00fb78d4263540db75c0f833c3 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 9b66add14946ca3a5f228994a9c7c5c947b33477..f8c58474ece4dde999bae24268c55b3fadeecbe3 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 0000000000000000000000000000000000000000..d102c31e5b52b84c1ae1211deb668dafaf72685e --- /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 0000000000000000000000000000000000000000..92b123dd7fee2d0b7910f1134174c655736cf606 --- /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") + +}