parseCommandLine example

            // much more bash-like.             // http://www.php.net/manual/en/readline.installation.php             static::$readline_support = extension_loaded('readline');

            // clear segments & options to keep testing clean             static::$segments = [];
            static::$options  = [];

            // Check our stream resource for color support             static::$isColored = static::hasColorSupport(STDOUT);

            static::parseCommandLine();

            static::$initialized = true;
        } elseif (defined('STDOUT')) {
            // If the command is being called from a controller             // we need to define STDOUT ourselves             // For "! defined('STDOUT')" see: https://github.com/codeigniter4/CodeIgniter4/issues/7047             define('STDOUT', 'php://output'); // @codeCoverageIgnore         }
    }

    /** * Get input from the shell, using readline or the standard STDIN * * Named options must be in the following formats: * php index.php user -v --v -name=John --name=John * * @param string $prefix You may specify a string with which to prompt the user. */
Home | Imprint | This part of the site doesn't use cookies.