Futilities/v0.6/clade/Sys/Opts/@removed

From WoozleCodes
Jump to navigation Jump to search
Removed Code
  • 2026-04-28 This won't work anymore, because these get construted through caInputRq->NewUserInput()
#
    public function __construct(array $arCmdArgs) {
        $this->SetupOptions();
        $this->ParseCommand($arCmdArgs);

        // do any app-specific setup
        $this->ProcessUserInput();
    }
#
    protected function SetupOptions() {
        $this->SetupBaseOptions();
        $this->SetupAppOptions();
    }
    protected function SetupBaseOptions() {
        $this->AddAppOptions([
          self::ksOPT_CONFIG_FILE   => ['-cf','--config-file'],
          ]);
    }
    abstract protected function SetupAppOptions();
  • 2026-04-28 This should now be obsolete because we no longer have "terms" (un-named inputs)
#
    protected function ProcessUserInput() {

        // process base options
        if ($this->HasCmdOption(self::ksOPT_CONFIG_FILE)) {
            // a specific conf file is requested
            $oOpt = $this->GetCmdOption(self::ksOPT_CONFIG_FILE);
            $fnConf = $oOpt->GetVal();
            // include the specified conf file; access settings via cConfig static fx().
            require_once($fnConf);
        }

        // process unnamed terms
        $arTerms = $this->GetCmdTerms();
        foreach ($arTerms as $idx => $sTerm) {
            $this->HandleTerm($idx,$sTerm);
        }
        $nTFnd = count($arTerms);
        $nTReq = $this->MinQtyTerms();
        if ($nTFnd < $nTReq) {
            echo
                'INPUT ERROR: '.$this->RenderTooFewTerms($nTFnd)."\n"
                .'USAGE: '.$this->RenderAppUsage()."\n"
                .$this->RenderCommonHelp()
                ;
            die();
        }
    }
  • 2026-04-28 Obsolete now because we don't use "terms".
#
    abstract protected function HandleTerm($idx,$sTerm);
    protected function HandleUnknownTerm($idx,$sTerm) {
        echo "Unexpected term: [$sTerm]\n";
    }
#
    // RETURNS: the minimum number of terms (non-option arguments) needed for usefulness
    #abstract protected function MinQtyTerms() : int; // 2026-04-28 OBSOLETE
    // RETURNS: string showing basic command structure for the app
    #abstract protected function RenderAppUsage() : string;  // 2026-04-28 OBSOLETE: handled by WUIDL
    // RETURNS: string describing what is missing
    protected function RenderTooFewTerms(int $qTerms) : string {
        $sc = get_called_class();
        $sf = __FUNCTION__;
        die("CODING PROMPT: class $sc needs to define $sf().\n");
    }