# Define all possible option for log command : sat doc <options>
parser = src.options.Options()
-parser.add_option('h', 'html', 'boolean', 'html', "Open sat html documentation in browser", None)
+parser.add_option('x', 'xml', 'boolean', 'xml', "Open sat xml/html documentation in browser (x as firefoX)", None)
parser.add_option('p', 'pdf', 'boolean', 'pdf', "Open sat pdf documentation in viewer", False)
parser.add_option('e', 'edit', 'boolean', 'edit', "edit/modify source dodumentation rst files", False)
parser.add_option('c', 'compile', 'boolean', 'compile', "how to compile html/pdf doc", False)
The doc command gives access to the sat documentation.
example:
->> sat doc # --html as default
->> sat doc --html
+>> sat doc # --xml as default
+>> sat doc --xml
>> sat doc --pdf
""")
logger.write("docdir %s\n" % docDir, 6)
logger.write("options %s\n" % options, 6)
- if options.html:
- src.system.show_in_editor(runner.cfg.USER.browser, htmlFile, logger)
if options.pdf:
+ if not os.path.isfile(pdfFile):
+ msg = "\npdf documentation not found. Please build it inside doc directory\n"\
+ "(follow README instructions in doc directory)\n"
+ logger.error(msg)
+ return 1
src.system.show_in_editor(runner.cfg.USER.pdf_viewer, pdfFile, logger)
- if options.edit:
+
+ elif options.edit:
src.system.show_in_editor(runner.cfg.USER.editor, rstFiles, logger)
src.system.show_in_editor(runner.cfg.USER.editor, rstFilesCommands, logger)
- if options.compile:
- logger.write("How to comile documentation:\n%s" % open(readmeFile,"r").read(), 3)
+
+ elif options.compile:
+ logger.write("How to compile documentation:\n%s" % open(readmeFile,"r").read(), 3)
+
+ else:
+ if not os.path.isfile(htmlFile):
+ msg = "\nhtml documentation not found. Please build it inside doc directory\n"\
+ "(follow README instructions in doc directory)\n"
+ logger.error(msg)
+ return 1
+ src.system.show_in_editor(runner.cfg.USER.browser, htmlFile, logger)
+
return 0