def cmnd(self, interactive=False, # Can also be called non-interactively ): cmndOutcome = self.getOpOutcome() if interactive: if not self.cmndLineValidate(outcome=cmndOutcome): return cmndOutcome callParamsDict = {} if not icm.cmndCallParamsValidate(callParamsDict, interactive, outcome=cmndOutcome): return cmndOutcome ####+END: G = icm.IcmGlobalContext() argsList = G.icmRunArgsGet().cmndArgs G_myFullName = sys.argv[0] for eachArg in argsList: outcome = icm.subProc_bash( """{icmName} -v 20 -i {command}""".format( icmName=G_myFullName, command=eachArg, ) ).log() if outcome.isProblematic(): return(icm.EH_badOutcome(outcome)) # eval("""{command}().cmnd(interactive=False,)""".format( # command=eachArg, # )) return cmndOutcome
def cmnd( self, interactive=False, # Can also be called non-interactively argsList=None, # or Args-Input ): cmndOutcome = self.getOpOutcome() if interactive: if not self.cmndLineValidate(outcome=cmndOutcome): return cmndOutcome effectiveArgsList = G.icmRunArgsGet().cmndArgs else: effectiveArgsList = argsList callParamsDict = {} if not icm.cmndCallParamsValidate( callParamsDict, interactive, outcome=cmndOutcome): return cmndOutcome ####+END: moduleDescription = """ * [[elisp:(org-show-subtree)][|=]] [[elisp:(org-cycle)][| *Description:* | ]] ** [[elisp:(org-cycle)][| ]] [Xref] :: *[Related/Xrefs:]* <<Xref-Here->> -- External Documents [[elisp:(org-cycle)][| ]] ** [[elisp:(org-cycle)][| ]] Model and Terminology :Overview: *** See BISOS Documentation for ICM's model and terminology ** [End-Of-Description] """ moduleUsage = """ * [[elisp:(org-show-subtree)][|=]] [[elisp:(org-cycle)][| *Usage:* | ]] ** How-Tos: *** TODO Edit icmInfo to identify author, etc *** TODO Select ICM type in g_icmChars *** TODO Enhance g_argsExtraSpecify for your parameters *** TODO Add your Commands *** TODO Enhance Examples Cmnd ** [End-Of-Usage] """ moduleStatus = """ * [[elisp:(org-show-subtree)][|=]] [[elisp:(org-cycle)][| *Status:* | ]] ** [[elisp:(org-cycle)][| ]] [Info] :: *[Current-Info:]* Status/Maintenance -- General TODO List [[elisp:(org-cycle)][| ]] ** TODO [[elisp:(org-cycle)][| ]] Current :: Just getting started [[elisp:(org-cycle)][| ]] ** [End-Of-Status] """ cmndArgsSpec = { "0&-1": ['moduleDescription', 'moduleUsage', 'moduleStatus'] } cmndArgsValid = cmndArgsSpec["0&-1"] for each in effectiveArgsList: if each in cmndArgsValid: print each if interactive: #print( str( __doc__ ) ) # This is the Summary: from the top doc-string #version(interactive=True) exec("""print({})""".format(each)) return (format(str(__doc__) + moduleDescription))
def cmnd( self, interactive=False, # Can also be called non-interactively argsList=None, # or Args-Input ): cmndOutcome = self.getOpOutcome() if interactive: if not self.cmndLineValidate(outcome=cmndOutcome): return cmndOutcome effectiveArgsList = G.icmRunArgsGet().cmndArgs else: effectiveArgsList = argsList callParamsDict = {} if not icm.cmndCallParamsValidate( callParamsDict, interactive, outcome=cmndOutcome): return cmndOutcome ####+END: moduleDescription = """ * [[elisp:(org-show-subtree)][|=]] [[elisp:(org-cycle)][| *Description:* | ]] ** [[elisp:(org-cycle)][| ]] [Xref] :: *[Related/Xrefs:]* <<Xref-Here->> -- External Documents [[elisp:(org-cycle)][| ]] ** [[elisp:(org-cycle)][| ]] Model and Terminology :Overview: This module is part of BISOS and its primary documentation is in http://www.by-star.net/PLPC/180047 ** [End-Of-Description] """ moduleUsage = """ * [[elisp:(org-show-subtree)][|=]] [[elisp:(org-cycle)][| *Usage:* | ]] ** How-Tos: ** [End-Of-Usage] """ moduleStatus = """ * [[elisp:(org-show-subtree)][|=]] [[elisp:(org-cycle)][| *Status:* | ]] ** [[elisp:(org-cycle)][| ]] [Info] :: *[Current-Info:]* Status/Maintenance -- General TODO List [[elisp:(org-cycle)][| ]] ** TODO [[elisp:(org-cycle)][| ]] Current :: Just getting started [[elisp:(org-cycle)][| ]] ** [End-Of-Status] """ cmndArgsSpec = { "0&-1": ['moduleDescription', 'moduleUsage', 'moduleStatus'] } cmndArgsValid = cmndArgsSpec["0&-1"] for each in effectiveArgsList: if each in cmndArgsValid: print each if interactive: #print( str( __doc__ ) ) # This is the Summary: from the top doc-string #version(interactive=True) exec("""print({})""".format(each)) return (format(str(__doc__) + moduleDescription))
def cmnd( self, interactive=False, # Can also be called non-interactively argsList=None, # or Args-Input ): cmndOutcome = self.getOpOutcome() if interactive: if not self.cmndLineValidate(outcome=cmndOutcome): return cmndOutcome effectiveArgsList = G.icmRunArgsGet().cmndArgs else: effectiveArgsList = argsList callParamsDict = {} if not icm.cmndCallParamsValidate( callParamsDict, interactive, outcome=cmndOutcome): return cmndOutcome ####+END: myName = self.myName() thisOutcome = icm.OpOutcome(invokerName=myName) print G.icmInfo for eachArg in effectiveArgsList: icm.ANN_here("{}".format(eachArg)) print(icm.__file__) print sys.path import imp print(imp.find_module('unisos/icm')) @ucf.runOnceOnly def echo(str): print str echo("first") echo("second") # Should not run return thisOutcome
def cmnd(self, interactive=False, # Can also be called non-interactively periodicity=None, # or Cmnd-Input ): cmndOutcome = self.getOpOutcome() if interactive: if not self.cmndLineValidate(outcome=cmndOutcome): return cmndOutcome callParamsDict = {'periodicity': periodicity, } if not icm.cmndCallParamsValidate(callParamsDict, interactive, outcome=cmndOutcome): return cmndOutcome periodicity = callParamsDict['periodicity'] ####+END: G = icm.IcmGlobalContext() argsList = G.icmRunArgsGet().cmndArgs G_myFullName = sys.argv[0] while True: for eachArg in argsList: outcome = icm.subProc_bash( """{icmName} -v 20 -i {command}""".format( icmName=G_myFullName, command=eachArg, ) ).log() if outcome.isProblematic(): return(icm.EH_badOutcome(outcome)) icm.ANN_note("sleeping for: {periodicity}".format(periodicity=periodicity)) try: time.sleep(int(periodicity)) except KeyboardInterrupt: print('\n\nKeyboard exception received. Exiting.') exit() icm.ANN_note("End of sleeping")
def cmnd( self, interactive=False, # Can also be called non-interactively ): cmndOutcome = self.getOpOutcome() if interactive: if not self.cmndLineValidate(outcome=cmndOutcome): return cmndOutcome callParamsDict = {} if not icm.cmndCallParamsValidate( callParamsDict, interactive, outcome=cmndOutcome): return cmndOutcome ####+END: def cmndDesc(): """ """ myName = self.myName() #G = icm.IcmGlobalContext() thisOutcome = icm.OpOutcome(invokerName=myName) G_myFullName = sys.argv[0] G_myName = os.path.basename(G_myFullName) icm.icmExampleMyName(G_myName, os.path.abspath(G_myFullName)) icm.G_commonBriefExamples() #icm.G_commonExamples() #g_curFuncName = icm.FUNC_currentGet().__name__ logControler = icm.LOG_Control() logControler.loggerSetLevel(20) #cmndThis = icm.FUNC_currentGet().__name__ logControler = icm.LOG_Control() logControler.loggerSetLevel(20) #verboseDebug = " -v 1" #verboseWarning = " -v 30" #verboseError = " -v 30" selectedPipPkg = "unisos.marme" icm.cmndExampleMenuChapter('*General Dev and Testing CMNDs*') cmndName = "unitTest" cmndArgs = "" cps = collections.OrderedDict() # cps['icmsPkgName'] = icmsPkgName icm.ex_gCmndMenuItem(cmndName, cps, cmndArgs, verbosity='little') icm.ex_gCmndMenuItem(cmndName, cps, cmndArgs, verbosity='full') icm.cmndExampleMenuChapter('*Start Template Maintenence*') def execLineEx(cmndStr): icm.ex_gExecMenuItem(execLine=cmndStr) templateFile = "/bisos/apps/defaults/update/sw/icm/py/start/icmBasic.py" thisFile = __file__ execLineEx("""diff {thisFile} {templateFile}""".format( thisFile=thisFile, templateFile=templateFile)) execLineEx("""cp {thisFile} {templateFile}""".format( thisFile=thisFile, templateFile=templateFile)) execLineEx("""cp {templateFile} {thisFile}""".format( thisFile=thisFile, templateFile=templateFile)) return (thisOutcome)