/src/php/wp-cli/commands/internals/eval-file.php
PHP | 17 lines | 14 code | 3 blank | 0 comment | 3 complexity | 26e10696167782dd4136f58f5bd0bc35 MD5 | raw file
Possible License(s): MIT
- <?php
- WP_CLI::add_command( 'eval-file', function( $args, $assoc_args ) {
- if ( empty( $args ) ) {
- WP_CLI::line( "usage: wp eval-file <path>" );
- exit;
- }
- foreach ( $args as $file ) {
- if ( !file_exists( $file ) ) {
- WP_CLI::error( "'$file' does not exist." );
- } else {
- include( $file );
- }
- }
- } );