示例#1
0
    def cmnd(self,
        interactive=False,        # Can also be called non-interactively
        argsList=[],         # 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

        cmndArgsSpec = self.cmndArgsSpec()
        if not icm.cmndArgsValidate(effectiveArgsList, cmndArgsSpec, outcome=cmndOutcome):
            return cmndOutcome

        action = effectiveArgsList[0]
        effectiveArgsList.pop(0)

        print(action)
        
        for each in effectiveArgsList:
            print(each)

        return cmndOutcome.set(
            opError=icm.OpError.Success,
            opResults=None,
        )
示例#2
0
    def cmnd(
            self,
            interactive=False,  # Can also be called non-interactively
            argsList=[],  # 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

        cmndArgsSpec = self.cmndArgsSpec()
        if not icm.cmndArgsValidate(
                effectiveArgsList, cmndArgsSpec, outcome=cmndOutcome):
            return cmndOutcome
####+END:

        action = effectiveArgsList[0]
        effectiveArgsList.pop(0)

        print(action)

        for each in effectiveArgsList:
            print(each)

        outcome = icm.subProc_bash("""\
echo action={action} {argsList}""".format(
            action=action, argsList=" ".join(effectiveArgsList))).log()
        if outcome.isProblematic(): return (icm.EH_badOutcome(outcome))

        return cmndOutcome.set(
            opError=icm.OpError.Success,
            opResults=None,
        )

        ####+BEGIN: bx:icm:python:method :methodName "cmndArgsSpec" :methodType "anyOrNone" :retType "bool" :deco "default" :argsList ""
        """
示例#3
0
    def cmnd(self,
        interactive=False,        # Can also be called non-interactively
        argsList=[],         # 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

        cmndArgsSpec = self.cmndArgsSpec()
        if not icm.cmndArgsValidate(effectiveArgsList, cmndArgsSpec, outcome=cmndOutcome):
            return cmndOutcome
####+END:

        action = effectiveArgsList[0]
        effectiveArgsList.pop(0)

        print action
        
        for each in effectiveArgsList:
            print each

        return cmndOutcome.set(
            opError=icm.OpError.Success,
            opResults=None,
        )

####+BEGIN: bx:icm:python:method :methodName "cmndArgsSpec" :methodType "anyOrNone" :retType "bool" :deco "default" :argsList ""
        """