# names from command line inputs override defaults for i in range(len(sys.argv)): if i > 0: if manpage_helper.setProductName(sys.argv[i]) < 0: exit(usageString) #add title to man page title = manpage_helper.cliName + " 8 \"" + time.strftime( "%B %d, %Y") + "\" \"\" \"" + manpage_helper.fullProductName + "\"" with open(tempTextFileName, 'w') as manfile: manfile.write(title) # add header info to man page with open(tempTextFileName, 'a') as manfile: manfile.write(manpage_helper.getFileWithReplacedData(headerFileName)) if (0 != captureHelpOutput()): exit("ERROR: Unable to capture help output for man page creation.") commandlist = createCommandList() # We now have a list of command parts, first part is command name for section header, # second part is the command syntax to parse for formatting manpagecommandlist = formatCommands(commandlist) # write formatted commands to man page file with open(tempTextFileName, 'a') as manfile: for cmd in range(len(manpagecommandlist)): manfile.write(manpagecommandlist[cmd])
tempTextFileName = "ixpdimm-monitorMan.txt" # names from command line inputs override defaults for i in range(len(sys.argv)): if i > 0: if manpage_helper.setProductName(sys.argv[i]) < 0: exit(usageString) # add title line title = manpage_helper.serviceName + " 8 \"" + time.strftime( "%B %d, %Y") + "\" \"\" \"" + manpage_helper.fullProductName + " Monitor\"" with open(tempTextFileName, 'w') as manfile: manfile.write(title) # copy input text file, replacing product name in text manfile.write(manpage_helper.getFileWithReplacedData(inputTextFileName)) # Create formatted man page from text file os.system('sed -f ixpdimm-cli.sed ' + tempTextFileName + ' > temp.txt') os.system('nroff -e -mandoc temp.txt 1>/dev/null') os.system('mv temp.txt ' + manpage_helper.serviceName + '.8') os.system('rm -f ' + manpage_helper.serviceName + '.8.gz') os.system('gzip ' + manpage_helper.serviceName + '.8') #delete temp files os.system('rm ' + tempTextFileName) # View man page by doing a 'man ./ixpdimm-monitor.8.gz' # Installation needs to put this ixpdimm-monitor.8.gz file in the man8 subdirectory in the # system's man path
tempTextFileName = "ixpdimm-cliMan.tmp" # names from command line inputs override defaults for i in range(len(sys.argv)): if i > 0: if manpage_helper.setProductName(sys.argv[i]) < 0: exit(usageString) #add title to man page title = manpage_helper.cliName + " 8 \"" + time.strftime("%B %d, %Y") + "\" \"\" \"" + manpage_helper.fullProductName + "\"" with open(tempTextFileName, 'w') as manfile: manfile.write(title) # add header info to man page with open(tempTextFileName, 'a') as manfile: manfile.write(manpage_helper.getFileWithReplacedData(headerFileName)); if (0 != captureHelpOutput()): exit("ERROR: Unable to capture help output for man page creation.") commandlist = createCommandList() # We now have a list of command parts, first part is command name for section header, # second part is the command syntax to parse for formatting manpagecommandlist = formatCommands(commandlist) # write formatted commands to man page file with open(tempTextFileName, 'a') as manfile: for cmd in range(len(manpagecommandlist)): manfile.write(manpagecommandlist[cmd])
#create temporary text file to be converted to the formatted man page later tempTextFileName = "ixpdimm-monitorMan.txt" # names from command line inputs override defaults for i in range(len(sys.argv)): if i > 0: if manpage_helper.setProductName(sys.argv[i]) < 0: exit(usageString) # add title line title = manpage_helper.serviceName + " 8 \"" + time.strftime("%B %d, %Y") + "\" \"\" \"" + manpage_helper.fullProductName + " Monitor\"" with open(tempTextFileName, 'w') as manfile: manfile.write(title) # copy input text file, replacing product name in text manfile.write(manpage_helper.getFileWithReplacedData(inputTextFileName)) # Create formatted man page from text file os.system('sed -f ixpdimm-cli.sed ' + tempTextFileName + ' > temp.txt') os.system('nroff -e -mandoc temp.txt 1>/dev/null') os.system('mv temp.txt ' + manpage_helper.serviceName + '.8') os.system('rm -f ' + manpage_helper.serviceName + '.8.gz') os.system('gzip ' + manpage_helper.serviceName + '.8') #delete temp files os.system('rm ' + tempTextFileName) # View man page by doing a 'man ./ixpdimm-monitor.8.gz' # Installation needs to put this ixpdimm-monitor.8.gz file in the man8 subdirectory in the # system's man path