# -*- coding: utf-8 -*-

""" #+begin_org
* ~[Summary]~ :: A =CS-Unit= for testing the DRF Executable generated by csxuFps_csu.py
#+end_org """

####+BEGIN: b:py3:cs:file/dblockControls :classification "cs-u"
""" #+begin_org
* [[elisp:(org-cycle)][| /Control Parameters Of This File/ |]] :: dblk ctrls classifications=cs-u
#+BEGIN_SRC emacs-lisp
(setq-local b:dblockControls t) ; (setq-local b:dblockControls nil)
(put 'b:dblockControls 'py3:cs:Classification "cs-u") ; one of cs-mu, cs-u, cs-lib, bpf-lib, pyLibPure
#+END_SRC
#+RESULTS:
: cs-u
#+end_org """
####+END:

####+BEGIN: b:prog:file/proclamations :outLevel 1
""" #+begin_org
* *[[elisp:(org-cycle)][| Proclamations |]]* :: Libre-Halaal Software --- Part Of BISOS ---  Poly-COMEEGA Format.
** This is Libre-Halaal Software. © Neda Communications, Inc. Subject to AGPL.
** It is part of BISOS (ByStar Internet Services OS)
** Best read and edited  with Blee in Poly-COMEEGA (Polymode Colaborative Org-Mode Enhance Emacs Generalized Authorship)
#+end_org """
####+END:

####+BEGIN: b:prog:file/particulars :authors ("./inserts/authors-mb.org")
""" #+begin_org
* *[[elisp:(org-cycle)][| Particulars |]]* :: Authors, version
** This File: /bisos/git/bxRepos/bisos-pip/csPlayer/py3/bisos/csPlayer/csmuFpsTo.py
** File True Name: /bisos/git/auth/bxRepos/bisos-pip/csPlayer/py3/bisos/csPlayer/csmuFpsTo.py
** Authors: Mohsen BANAN, http://mohsen.banan.1.byname.net/contact
#+end_org """
####+END:

####+BEGIN: b:py3:file/particulars-csInfo :status "inUse"
""" #+begin_org
* *[[elisp:(org-cycle)][| Particulars-csInfo |]]*
#+end_org """
import typing
csInfo: typing.Dict[str, typing.Any] = { 'moduleName': ['drf_csPlayer'], }
csInfo['version'] = '202602130000'
csInfo['status']  = 'inUse'
csInfo['panel'] = 'drf_csPlayer-Panel.org'
csInfo['groupingType'] = 'IcmGroupingType-pkged'
csInfo['cmndParts'] = 'IcmCmndParts[common] IcmCmndParts[param]'
####+END:

""" #+begin_org
* [[elisp:(org-cycle)][| ~Description~ |]] :: Test and inspect DRF Executable files
This is a =CS-Unit= for testing the dynamically generated drfExecutable.py files.
It validates that the generated executables can be imported and their operationsData
is correctly structured for use by drf_csPlayer_pipDevBisos3 and the DRF backend.

** Status: Testing and validation of generated DRF executables
#+end_org """

####+BEGIN: b:prog:file/orgTopControls :outLevel 1
""" #+begin_org
* [[elisp:(org-cycle)][| Controls |]] :: [[elisp:(delete-other-windows)][(1)]] | [[elisp:(show-all)][Show-All]]  [[elisp:(org-shifttab)][Overview]]  [[elisp:(progn (org-shifttab) (org-content))][Content]] | [[file:Panel.org][Panel]] | [[elisp:(blee:ppmm:org-mode-toggle)][Nat]] | [[elisp:(bx:org:run-me)][Run]] | [[elisp:(bx:org:run-me-eml)][RunEml]] | [[elisp:(progn (save-buffer) (kill-buffer))][S&Q]]  [[elisp:(save-buffer)][Save]]  [[elisp:(kill-buffer)][Quit]] [[elisp:(org-cycle)][| ]]
** /Version Control/ ::  [[elisp:(call-interactively (quote cvs-update))][cvs-update]]  [[elisp:(vc-update)][vc-update]] | [[elisp:(bx:org:agenda:this-file-otherWin)][Agenda-List]]  [[elisp:(bx:org:todo:this-file-otherWin)][ToDo-List]]

#+end_org """
####+END:

####+BEGIN: b:py3:file/workbench :outLevel 1
""" #+begin_org
* [[elisp:(org-cycle)][| Workbench |]] :: [[elisp:(python-check (format "/bisos/venv/py3/bisos3/bin/python -m pyclbr %s" (bx:buf-fname))))][pyclbr]] || [[elisp:(python-check (format "/bisos/venv/py3/bisos3/bin/python -m pydoc ./%s" (bx:buf-fname))))][pydoc]] || [[elisp:(python-check (format "/bisos/pipx/bin/pyflakes %s" (bx:buf-fname)))][pyflakes]] | [[elisp:(python-check (format "/bisos/pipx/bin/pychecker %s" (bx:buf-fname))))][pychecker (executes)]] | [[elisp:(python-check (format "/bisos/pipx/bin/pycodestyle %s" (bx:buf-fname))))][pycodestyle]] | [[elisp:(python-check (format "/bisos/pipx/bin/flake8 %s" (bx:buf-fname))))][flake8]] | [[elisp:(python-check (format "/bisos/pipx/bin/pylint %s" (bx:buf-fname))))][pylint]]  [[elisp:(org-cycle)][| ]]
#+end_org """
####+END:

####+BEGIN: b:py3:cs:orgItem/basic :type "=PyImports= "  :title "*Py Library IMPORTS*" :comment "-- Framework and External Packages Imports"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  =PyImports=  [[elisp:(outline-show-subtree+toggle)][||]] *Py Library IMPORTS* -- Framework and External Packages Imports  [[elisp:(org-cycle)][| ]]
#+end_org """
####+END:

# import os
import collections
# import pathlib
# import invoke

####+BEGIN: b:py3:cs:framework/imports :basedOn "classification"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CsFrmWrk   [[elisp:(outline-show-subtree+toggle)][||]] *Imports* =Based on Classification=cs-u=
#+end_org """
from bisos import b
from bisos.b import cs
from bisos.b import b_io
from bisos.common import csParam

import collections
####+END:

from bisos.csPlayer import drf_csPlayer_pipDevBisos3

from pathlib import Path
import importlib.util
from bisos.csPlayer import drf_csPlayer_pipDevBisos3

####+BEGIN: b:py3:cs:orgItem/basic :type "=Executes=  "  :title "CSU-Lib Executions" :comment "-- cs.invOutcomeReportControl"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  =Executes=   [[elisp:(outline-show-subtree+toggle)][||]] CSU-Lib Executions -- cs.invOutcomeReportControl  [[elisp:(org-cycle)][| ]]
#+end_org """
####+END:

cs.invOutcomeReportControl(cmnd=True, ro=True)

####+BEGIN: b:py3:cs:orgItem/section :title "Common Parameters Specification" :comment "based on cs.param.CmndParamDict -- As expected from CSU-s"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  /Section/    [[elisp:(outline-show-subtree+toggle)][||]] *Common Parameters Specification* based on cs.param.CmndParamDict -- As expected from CSU-s  [[elisp:(org-cycle)][| ]]
#+end_org """
####+END:

####+BEGIN: blee:bxPanel:foldingSection :outLevel 0 :sep nil :title "Direct Command Services" :anchor ""  :extraInfo "Examples and CSs"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*     [[elisp:(outline-show-subtree+toggle)][| _Direct Command Services_: |]]  Examples and CSs  [[elisp:(org-shifttab)][<)]] E|
#+end_org """
####+END:

####+BEGIN: b:py3:cs:cmnd/classHead :cmndName "examples_csu" :comment "" :parsMand "" :parsOpt "" :argsMin 0 :argsMax 0 :pyInv ""
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CmndSvc-   [[elisp:(outline-show-subtree+toggle)][||]] <<examples_csu>>  =verify= ro=cli   [[elisp:(org-cycle)][| ]]
#+end_org """
class examples_csu(cs.Cmnd):
    cmndParamsMandatory = [ ]
    cmndParamsOptional = [ ]
    cmndArgsLen = {'Min': 0, 'Max': 0,}

    @cs.track(fnLoc=True, fnEntry=True, fnExit=True)
    def cmnd(self,
             rtInv: cs.RtInvoker,
             cmndOutcome: b.op.Outcome,
    ) -> b.op.Outcome:

        failed = b_io.eh.badOutcome
        callParamsDict = {}
        if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, None).isProblematic():
            return failed(cmndOutcome)
####+END:
        self.cmndDocStr(f""" #+begin_org
** [[elisp:(org-cycle)][| *CmndDesc:* | ]]  Examples of DRF Executable testing commands.
        #+end_org """)

        od = collections.OrderedDict
        cmnd = cs.examples.cmndEnter

        oneCsxu = "facter.cs"

        csxuFpsBase = "/bisos/var/csxu/pip_dev-bisos3/available"
        csxuName = cs.G.icmMyName()
        csxuFpsBasePars = od([('csxuFpsBasePath', csxuFpsBase),])
        csxuNamePars = od([('csxuName', csxuName),])

        csxuDerivedBase = "/bisos/var/csxu/pip_dev-bisos3/available/facter.cs/derived"
        drfExecPath = "drfExecutable.py"

        csxuDerivedBasePars = od([('csxuDerivedBasePath', csxuDerivedBase),])
        drfExecPathPars = od([('drfExecPath', drfExecPath),])
        allPars = od(list(csxuDerivedBasePars.items()) + list(drfExecPathPars.items()))

        cs.examples.menuChapter('=CSXU FPs Create=')

        cmnd('csxuInSchemaFps', pars=od(list(csxuFpsBasePars.items()) + list(csxuNamePars.items())), comment=f"# Add {csxuName} to availables")

        cmnd('availablesAdd', pars=od(list(csxuFpsBasePars.items())), args=oneCsxu, comment=f"# Add {oneCsxu} to availables")


        cs.examples.menuChapter('=Updated Derived Artifacts=')

        cmnd('availablesList', pars=od(list(csxuFpsBasePars.items())), comment=f"# List Available CSXUs")

        cmnd('availablesUpdate', pars=od(list(csxuFpsBasePars.items())), args=oneCsxu, comment=f"# Update Available CSXUs")
        cmnd('availablesUpdate', pars=od(list(csxuFpsBasePars.items())), wrapper=f"{csxuName} --csxuFpsBasePath={csxuFpsBase} -i availablesList |",  comment=f"# Update Available CSXUs")

        return(cmndOutcome)




####+BEGIN: b:py3:cs:cmnd/classHead :cmndName "availablesList" :comment "" :extent "verify" :ro "cli" :parsMand "" :parsOpt "csxuFpsBasePath" :argsMin 0 :argsMax 9999 :pyInv ""
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CmndSvc-   [[elisp:(outline-show-subtree+toggle)][||]] <<availablesList>>  =verify= parsOpt=csxuFpsBasePath ro=cli   [[elisp:(org-cycle)][| ]]
#+end_org """
class availablesList(cs.Cmnd):
    cmndParamsMandatory = [ ]
    cmndParamsOptional = [ 'csxuFpsBasePath', ]
    cmndArgsLen = {'Min': 0, 'Max': 0,}

    @cs.track(fnLoc=True, fnEntry=True, fnExit=True)
    def cmnd(self,
             rtInv: cs.RtInvoker,
             cmndOutcome: b.op.Outcome,
             csxuFpsBasePath: typing.Optional[str]=None,  # Cs Optional Param
    ) -> b.op.Outcome:

        failed = b_io.eh.badOutcome
        callParamsDict = {'csxuFpsBasePath': csxuFpsBasePath, }
        if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, None).isProblematic():
            return failed(cmndOutcome)
        csxuFpsBasePath = csParam.mappedValue('csxuFpsBasePath', csxuFpsBasePath)
####+END:

        self.cmndDocStr(f""" #+begin_org
** [[elisp:(org-cycle)][| *CmndDesc:* | ]]  Walk through csxuFpsBase directory and list available CSXUs as a space separated list of strings.
        #+end_org """)

        try:
            # Get the base directory path
            base_path = Path(csxuFpsBasePath)
            
            if not base_path.exists():
                return b_io.eh.badOutcome(cmndOutcome, f"csxuFpsBase path does not exist: {base_path}")
            
            if not base_path.is_dir():
                return b_io.eh.badOutcome(cmndOutcome, f"csxuFpsBase is not a directory: {base_path}")
            
            # Discover CSXU directories - each subdirectory is a potential CSXU
            available_csxus = []
            
            for item in sorted(base_path.iterdir()):
                if item.is_dir():
                    available_csxus.append(item.name)
            
            # Output as space-separated string (Python literal)
            result = ' '.join(available_csxus)
            
            return cmndOutcome.set(
                opError=b.OpError.Success,
                opResults=result,
            )
            
        except Exception as e:
            return b_io.eh.badOutcome(cmndOutcome, f"Error listing available CSXUs: {e}")


####+BEGIN: b:py3:cs:cmnd/classHead :cmndName "availablesAdd" :comment "For each CSXU Update Add it to the availabls list" :parsMand "" :parsOpt "csxuFpsBasePath" :argsMin 0 :argsMax 9999 :pyInv "pyStdinArgs"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CmndSvc-   [[elisp:(outline-show-subtree+toggle)][||]] <<availablesAdd>>  *For each CSXU Update Add it to the availabls list*  =verify= parsOpt=csxuFpsBasePath argsMax=9999 ro=cli pyInv=pyStdinArgs   [[elisp:(org-cycle)][| ]]
#+end_org """
class availablesAdd(cs.Cmnd):
    cmndParamsMandatory = [ ]
    cmndParamsOptional = [ 'csxuFpsBasePath', ]
    cmndArgsLen = {'Min': 0, 'Max': 9999,}

    @cs.track(fnLoc=True, fnEntry=True, fnExit=True)
    def cmnd(self,
             rtInv: cs.RtInvoker,
             cmndOutcome: b.op.Outcome,
             csxuFpsBasePath: typing.Optional[str]=None,  # Cs Optional Param
             argsList: typing.Optional[list[str]]=None,  # CsArgs
             pyStdinArgs: typing.Any=None,   # pyInv Argument
    ) -> b.op.Outcome:
        """For each CSXU Update Add it to the availabls list"""
        failed = b_io.eh.badOutcome
        callParamsDict = {'csxuFpsBasePath': csxuFpsBasePath, }
        if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, argsList).isProblematic():
            return failed(cmndOutcome)
        cmndArgsSpecDict = self.cmndArgsSpec()
        csxuFpsBasePath = csParam.mappedValue('csxuFpsBasePath', csxuFpsBasePath)
####+END:
        self.cmndDocStr(f""" #+begin_org
** [[elisp:(org-cycle)][| *CmndDesc:* | ]] For each CSXU (as args or stdin) add it to availables list
        #+end_org """)

        self.captureRunStr(""" #+begin_org
#+begin_src sh :results output :session shared
  NotYet
#+end_src
#+RESULTS:
:
: OpError.Success
        #+end_org """)
        if self.justCaptureP(): return cmndOutcome

        def processEach(each):
            """Add this CSXU to availables. Check if CSXU is already available, if so report and return, other wise invoke update"""
            # Check if CSXU is already available
            csxu_path = Path(csxuFpsBasePath) / each
            if csxu_path.exists():
                print(f"CSXU '{each}' is already available at {csxu_path}")
                return
            
            # CSXU not available, so update it
            if availablesUpdate(cmndOutcome=cmndOutcome).pyCmnd(
                    csxuFpsBasePath=csxuFpsBasePath,
                    argsList=[each,],
            ).isProblematic(): 
                return(b_io.eh.badOutcome(cmndOutcome))


####+BEGIN: b:py3:func/processArgsAndStdin :comment auto-generated
        """ #+begin_org
***  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  processArgsAndStdin [[elisp:(outline-show-subtree+toggle)][||]]  =auto-generated=  [[elisp:(org-cycle)][| ]]
        #+end_org """
        if not pyStdinArgs:
            pyStdinArgs = b_io.stdin.read()

        def processArgsAndStdin():
            cmndArgsSpecDict = self.cmndArgsSpec()
            cliArgs = self.cmndArgsGet("0&9999", cmndArgsSpecDict, argsList)

            effectiveArgs = cliArgs + pyStdinArgs.split()

            if len(effectiveArgs) == 0:
                b_io.eh.critical_usageError(
                    "Missing Input: One of cliArgs, stdin or pyArgs; should have an input."
                )

            for each in effectiveArgs:
                processEach(each)

        processArgsAndStdin()

####+END:

        return(cmndOutcome)


####+BEGIN: b:py3:cs:method/args :methodName "cmndArgsSpec" :methodType "anyOrNone" :retType "bool" :deco "default" :argsList "self"
    """ #+begin_org
**  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  Mtd-T-anyOrNone [[elisp:(outline-show-subtree+toggle)][||]] /cmndArgsSpec/ deco=default  deco=default   [[elisp:(org-cycle)][| ]]
    #+end_org """
    @cs.track(fnLoc=True, fnEntry=True, fnExit=True)
    def cmndArgsSpec(self, ):
####+END:
        """  #+begin_org
** [[elisp:(org-cycle)][| *cmndArgsSpec:* | ]]
        #+end_org """

        cmndArgsSpecDict = cs.arg.CmndArgsSpecDict()
        cmndArgsSpecDict.argsDictAdd(
            argPosition="0&9999",
            argName="inputs",
            argChoices=[],
            argDescription="Rest of args for use by action"
        )

        return cmndArgsSpecDict

####+BEGIN: b:py3:cs:cmnd/classHead :cmndName "availablesUpdate" :comment "For each CSXU Update its Derived information" :parsMand "" :parsOpt "csxuFpsBasePath" :argsMin 0 :argsMax 9999 :pyInv "pyStdinArgs"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CmndSvc-   [[elisp:(outline-show-subtree+toggle)][||]] <<availablesUpdate>>  *For each CSXU Update its Derived information*  =verify= parsOpt=csxuFpsBasePath argsMax=9999 ro=cli pyInv=pyStdinArgs   [[elisp:(org-cycle)][| ]]
#+end_org """
class availablesUpdate(cs.Cmnd):
    cmndParamsMandatory = [ ]
    cmndParamsOptional = [ 'csxuFpsBasePath', ]
    cmndArgsLen = {'Min': 0, 'Max': 9999,}

    @cs.track(fnLoc=True, fnEntry=True, fnExit=True)
    def cmnd(self,
             rtInv: cs.RtInvoker,
             cmndOutcome: b.op.Outcome,
             csxuFpsBasePath: typing.Optional[str]=None,  # Cs Optional Param
             argsList: typing.Optional[list[str]]=None,  # CsArgs
             pyStdinArgs: typing.Any=None,   # pyInv Argument
    ) -> b.op.Outcome:
        """For each CSXU Update its Derived information"""
        failed = b_io.eh.badOutcome
        callParamsDict = {'csxuFpsBasePath': csxuFpsBasePath, }
        if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, argsList).isProblematic():
            return failed(cmndOutcome)
        cmndArgsSpecDict = self.cmndArgsSpec()
        csxuFpsBasePath = csParam.mappedValue('csxuFpsBasePath', csxuFpsBasePath)
####+END:
        self.cmndDocStr(f""" #+begin_org
** [[elisp:(org-cycle)][| *CmndDesc:* | ]] For each CSXU (as args or stdin) update all of its derived artifacts
        #+end_org """)

        self.captureRunStr(""" #+begin_org
#+begin_src sh :results output :session shared
  NotYet
#+end_src
#+RESULTS:
:
: OpError.Success
        #+end_org """)
        if self.justCaptureP(): return cmndOutcome

        def processEach(each):
            """Update all derived artifacts of this CSXU"""
            # Build paths for this CSXU
            csxu_path = Path(csxuFpsBasePath) / each
            csxu_derived_base = csxu_path / "derived"
            
            # Ensure derived directory exists
            csxu_derived_base.mkdir(parents=True, exist_ok=True)
            
            # 1. First, update the File Parameters (inSchema)
            if b.subProc.Op(outcome=cmndOutcome, log=1,).bash(
                    f"""{each} -i csxuInSchemaFps --csxuFpsBasePath="{csxuFpsBasePath}\"""",
            ).isProblematic():  
                return(b_io.eh.badOutcome(cmndOutcome))

            if b.subProc.Op(outcome=cmndOutcome, log=1,).bash(
                    f"""{each} -i csxuFpsToPyDict --csxuFpsBasePath="{csxuFpsBasePath}\"""",
            ).isProblematic():
                return(b_io.eh.badOutcome(cmndOutcome))


            # 2. Generate GraphViz PDF diagram
            if b.subProc.Op(outcome=cmndOutcome, log=1,).bash(
                    f"""{each} -i csxuFpsToGraphviz --csxuFpsBasePath="{csxuFpsBasePath}" --csxuName="{each}" --csxuDerivedBasePath="{csxu_derived_base}\"""",
            ).isProblematic():  
                return(b_io.eh.badOutcome(cmndOutcome))
            
            # 3. Generate DRF Executable
            if b.subProc.Op(outcome=cmndOutcome, log=1,).bash(
                    f"""{each} -i csxuFpsToDrfExecutable --csxuFpsBasePath="{csxuFpsBasePath}" --csxuName="{each}" --csxuDerivedBasePath="{csxu_derived_base}\"""",
            ).isProblematic():  
                return(b_io.eh.badOutcome(cmndOutcome))
            
            # 4. Generate CLI Completion
            if b.subProc.Op(outcome=cmndOutcome, log=1,).bash(
                    f"""{each} -i csxuFpsToCliCompgen --csxuFpsBasePath="{csxuFpsBasePath}" --csxuName="{each}" --csxuDerivedBasePath="{csxu_derived_base}\"""",
            ).isProblematic():  
                return(b_io.eh.badOutcome(cmndOutcome))



####+BEGIN: b:py3:func/processArgsAndStdin :comment auto-generated
        """ #+begin_org
***  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  processArgsAndStdin [[elisp:(outline-show-subtree+toggle)][||]]  =auto-generated=  [[elisp:(org-cycle)][| ]]
        #+end_org """
        if not pyStdinArgs:
            pyStdinArgs = b_io.stdin.read()

        def processArgsAndStdin():
            cmndArgsSpecDict = self.cmndArgsSpec()
            cliArgs = self.cmndArgsGet("0&9999", cmndArgsSpecDict, argsList)

            effectiveArgs = cliArgs + pyStdinArgs.split()

            if len(effectiveArgs) == 0:
                b_io.eh.critical_usageError(
                    "Missing Input: One of cliArgs, stdin or pyArgs; should have an input."
                )

            for each in effectiveArgs:
                processEach(each)

        processArgsAndStdin()

####+END:

        return(cmndOutcome)


####+BEGIN: b:py3:cs:method/args :methodName "cmndArgsSpec" :methodType "anyOrNone" :retType "bool" :deco "default" :argsList "self"
    """ #+begin_org
**  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  Mtd-T-anyOrNone [[elisp:(outline-show-subtree+toggle)][||]] /cmndArgsSpec/ deco=default  deco=default   [[elisp:(org-cycle)][| ]]
    #+end_org """
    @cs.track(fnLoc=True, fnEntry=True, fnExit=True)
    def cmndArgsSpec(self, ):
####+END:
        """  #+begin_org
** [[elisp:(org-cycle)][| *cmndArgsSpec:* | ]]
        #+end_org """

        cmndArgsSpecDict = cs.arg.CmndArgsSpecDict()
        cmndArgsSpecDict.argsDictAdd(
            argPosition="0&9999",
            argName="inputs",
            argChoices=[],
            argDescription="Rest of args for use by action"
        )

        return cmndArgsSpecDict




####+BEGIN: b:py3:cs:framework/endOfFile :basedOn "classification"
""" #+begin_org
* [[elisp:(org-cycle)][| *End-Of-Editable-Text* |]] :: emacs and org variables and control parameters
#+end_org """

#+STARTUP: showall

### local variables:
### no-byte-compile: t
### end:
####+END:
