From: Cédric Aguerre Date: Tue, 25 Oct 2016 11:33:41 +0000 (+0200) Subject: add salome doc command X-Git-Tag: V8_2_0a1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4f0ed5079119e1cbd96aab646d64833e02a71034;p=modules%2Fkernel.git add salome doc command --- diff --git a/bin/salomeContext.py b/bin/salomeContext.py index ac6f616bb..5769848f6 100644 --- a/bin/salomeContext.py +++ b/bin/salomeContext.py @@ -51,6 +51,8 @@ Commands: Do not start a new one. test Run SALOME tests. info Display some information about SALOME. + doc Show online module documentation (if available). + Module names must be separated by blank characters. help Show this message. If no command is given, default to start. @@ -225,6 +227,7 @@ class SalomeContext: 'killall' : '_killAll', 'test' : '_runTests', 'info' : '_showInfo', + 'doc' : '_showDoc', 'help' : '_usage', 'coffee' : '_makeCoffee', 'car' : '_getCar', @@ -508,6 +511,30 @@ Available options are: self._runAppli(["--version"]) # + def _showDoc(self, args=None): + if args is None: + args = [] + + modules = args + if not modules: + print "Module(s) not provided to command: salome doc " + return + + appliPath = os.getenv("ABSOLUTE_APPLI_PATH") + if not appliPath: + raise SalomeContextException("Unable to find application path. Please check that the variable ABSOLUTE_APPLI_PATH is set.") + baseDir = os.path.join(appliPath, "share", "doc", "salome") + for module in modules: + docfile = os.path.join(baseDir, "gui", module.upper(), "index.html") + if not os.path.isfile(docfile): + docfile = os.path.join(baseDir, "tui", module.upper(), "index.html") + if not os.path.isfile(docfile): + docfile = os.path.join(baseDir, "dev", module.upper(), "index.html") + if os.path.isfile(docfile): + out, err = subprocess.Popen(["xdg-open", docfile]).communicate() + else: + print "Online documentation is not accessible for module:", module + def _usage(self, unused=None): usage() #