<commit_before><?php

WP_CLI::add_command( 'shell', new Shell_Command );

class Shell_Command extends WP_CLI_Command {

	/**
	 * Open an interactive shell environment.
	 */
	public function __invoke() {
		if ( function_exists( 'readline' ) ) {
			$repl = 'repl_readline';
		} else {
			$repl = 'repl_basic';
		}

		while ( true ) {
			$in = call_user_func( array( __CLASS__, $repl ), 'wp> ' );

			if ( 'exit' == $in )
				return;

			$r = eval( $in );

			if ( false === $r )
				continue;

			if ( null === $r )
				\WP_CLI::line();
			else
				var_export( $r );
		}
	}

	private static function repl_readline( $str ) {
		$line = readline( $str );
		readline_add_history( $line );
		return $line;
	}

	private static function repl_basic( $str ) {
		\WP_CLI::out( $str );
		return \cli\input();
	}
}
<commit_msg>automatically return all expressions<commit_after><?php

WP_CLI::add_command( 'shell', new Shell_Command );

class Shell_Command extends WP_CLI_Command {

	/**
	 * Open an interactive shell environment.
	 */
	public function __invoke() {
		if ( function_exists( 'readline' ) ) {
			$repl = 'repl_readline';
		} else {
			$repl = 'repl_basic';
		}

		while ( true ) {
			$in = call_user_func( array( __CLASS__, $repl ), 'wp> ' );

			if ( 'exit' == $in )
				return;

			if ( !preg_match( '/^\s*(echo|return)\s+/', $in ) )
				$in = 'return ' . $in;

			$r = eval( $in );

			if ( false === $r )
				continue;

			if ( null === $r )
				\WP_CLI::line();
			else
				\WP_CLI::line( var_export( $r, false ) );
		}
	}

	private static function repl_readline( $str ) {
		$line = readline( $str );
		readline_add_history( $line );
		return $line;
	}

	private static function repl_basic( $str ) {
		\WP_CLI::out( $str );
		return \cli\input();
	}
}

{'fraction_non_alphanumeric': 0.17084282460136674, 'fraction_numerical': 0.0, 'mean_word_length': 2.921875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2640145', 'n_tokens_mistral': 764, 'n_tokens_neox': 662, 'n_words': 156}