src/Charcoal/App/Script/ArgScriptTrait.php
protected function parseArguments()
    {
        $cli  = $this->climate();
        $args = $cli->arguments;

        $ask    = $args->defined('interactive');
        $params = $this->arguments();
        foreach ($params as $key => $param) {
            $setter = $this->setter($key);

            if (!is_callable([ $this, $setter ])) {
                continue;
            }

            $value = $args->get($key);
            if (!empty($value) || is_numeric($value)) {
                $this->{$setter}($value);
            }

            if ($ask) {
                if (isset($param['prompt'])) {
                    $label = $param['prompt'];
                } else {
                    continue;
                }

                $value = $this->input($key);
                if (!empty($value) || is_numeric($value)) {
                    $this->{$setter}($value);
                }
            }
        }

        return $this;
    }
protected function parseArguments()
    {
        $cli  = $this->climate();
        $args = $cli->arguments;

        $ask    = $args->defined('interactive');
        $params = $this->arguments();
        foreach ($params as $key => $param) {
            $setter = $this->setter($key);

            if (!is_callable([ $this, $setter ])) {
                continue;
            }

            $value = $args->get($key);
            if (!empty($value) || is_numeric($value)) {
                $this->{$setter}($value);
            }

            if ($ask) {
                if (isset($param['prompt'])) {
                    $label = $param['prompt'];
                } else {
                    continue;
                }

                $value = $this->input($key);
                if (!empty($value) || is_numeric($value)) {
                    $this->{$setter}($value);
                }
            }
        }

        return $this;
    }
protected function parseArguments ( ) { $ cli = $ this -> climate ( ) ; $ args = $ cli -> arguments ; $ ask = $ args -> defined ( 'interactive' ) ; $ params = $ this -> arguments ( ) ; foreach ( $ params as $ key => $ param ) { $ setter = $ this -> setter ( $ key ) ; if ( ! is_callable ( [ $ this , $ setter ] ) ) { continue ; } $ value = $ args -> get ( $ key ) ; if ( ! empty ( $ value ) || is_numeric ( $ value ) ) { $ this -> { $ setter } ( $ value ) ; } if ( $ ask ) { if ( isset ( $ param [ 'prompt' ] ) ) { $ label = $ param [ 'prompt' ] ; } else { continue ; } $ value = $ this -> input ( $ key ) ; if ( ! empty ( $ value ) || is_numeric ( $ value ) ) { $ this -> { $ setter } ( $ value ) ; } } } return $ this ; }
Parse command line arguments into script properties.

@throws RuntimeException If a checkbox/radio argument has no options.
@return self
Parse command line arguments into script properties .