WP_CLI::get_value_from_arg_or_stdin()
Read value from a positional argument or from STDIN.
Метод класса: WP_CLI{}
Хуков нет.
Возвращает
Строку
.
Использование
$result = WP_CLI::get_value_from_arg_or_stdin( $args, $index );
- $args(массив) (обязательный)
- The list of positional arguments.
- $index(int) (обязательный)
- At which position to check for the value.
Код WP_CLI::get_value_from_arg_or_stdin() WP CLI::get value from arg or stdin WP-CLI 2.8.0-alpha
public static function get_value_from_arg_or_stdin( $args, $index ) { if ( isset( $args[ $index ] ) ) { $raw_value = $args[ $index ]; } else { // We don't use file_get_contents() here because it doesn't handle // Ctrl-D properly, when typing in the value interactively. $raw_value = ''; while ( false !== ( $line = fgets( STDIN ) ) ) { $raw_value .= $line; } } return $raw_value; }