Ferreteria/v0.6/clade/IO/Aspect/Connx/Plug/Shell

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | IO‎ | Aspect‎ | Connx‎ | Plug
Revision as of 14:11, 31 October 2025 by Woozle (talk | contribs) (Created page with "{{page/clade/v2 |fam= {{!}} align=right {{!}} {{l/ver/clade|IO\Aspect\Connx|Plug}} {{!}} align=center {{!}} → {{l/ver/clade|IO\Aspect\Connx\Plug|Shell}} → {{!}} align=left {{!}} {{l/ver/clade|IO\Aspect\Connx\Plug\Shell|Local}}<br> {{l/ver/clade|IO\Aspect\Connx\Plug\Shell|Remote}} |alia= {{!-!}} '''BufferIface''' {{!!}} {{l/ver/clade/full|p=ferreteria|IO\Aspect\Connx|Buffer}} {{!-!}} '''MemBuffClass''' {{!!}} {{l/ver/clade/full|p=ferreteria|IO\Aspect\Connx\Buf...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
clade: IO\Aspect\Connx\Plug\Shell
Clade Family
Plug Shell

Local
Remote

Clade Aliases
Alias Clade
BufferIface IO\Aspect\Connx\Buffer
MemBuffClass IO\Aspect\Connx\Buffer\InMem
Base* [ca,i] IO\Aspect\Connx\Plug
ProcIface IO\Aspect\Connx\Process
SelfIface IO\Aspect\Connx\Plug\Shell
Subpages

Code

as of 2025-10-31

interface iShell extends BaseIface {
    // LIFECYCLE
    function Open() : ActionIface;
    function Shut() : ActionIface;
    // OUTPUT
    #{I} function DescribeInline() : string;
}
abstract class caShell extends BaseClass implements SelfIface {

    // ++ OBJECTS ++ //

    protected function NewAction() : ActionIface { return new ($this->ActionClass()); }

    // -- OBJECTS -- //
    // ++ ACTION ++ //

    /**
     * ACTION: Sends a command, buffers the response, closes the command process
     * HISTORY:
     *  2024-11-24 created. This is experimental; if it works,
     *    this kind of thing should probably be encapsulated in its own class.
     *  2024-11-25 moved from shell/Secure to Shell
     *  2025-03-21 moved core code from Shell to Process::Run(); this now calls that.
     */
    public function DoCommand(string|array $saCmd, BufferIface $oBuff, ?CommOpIface $oAct=NULL) : CommOpIface {
        $oProc = ProcClass::FromCommand($saCmd);
        $oProc->SetRecvBuff($oBuff);
        if (is_null($oAct)) {
            $oAct = $this->NewAction();
        }
        $oProc->SetOpStator($oAct);

        return $oProc->Run();
    }
    public function OpenProcess(string|array $saCmd) : ProcIface {
        $oProc = ProcClass::FromCommand($saCmd);
        $oAct = $this->NewAction();
        $oProc->SetOpStator($oAct);
        return $oProc;
    }

    // -- ACTION -- //
}