function drush_print

8.0.x output.inc drush_print($message = '', $indent = 0, $handle = NULL, $newline = TRUE)
6.x output.inc drush_print($message = '', $indent = , $handle = NULL, $newline = TRUE)
7.x output.inc drush_print($message = '', $indent = 0, $handle = NULL, $newline = TRUE)
3.x drush.inc drush_print($message = '', $indent = 0)
master output.inc drush_print($message = '', $indent = 0, $handle = NULL, $newline = TRUE)

Prints a message with optional indentation. In general, drush_log($message, 'ok') is often a better choice than this function. That gets your confirmation message (for example) into the logs for this drush request. Consider that drush requests may be executed remotely and non interactively.

Parameters

$message: The message to print.

$indent: The indentation (space chars)

$handle: File handle to write to. NULL will write to standard output, STDERR will write to the standard error. See http://php.net/manual/en/features.commandline.io-streams.php

$newline: Add a "\n" to the end of the output. Defaults to TRUE.

Related topics

61 calls to drush_print()
DrupalServer::request_done in commands/runserver/runserver-drupal.inc
Override request done event.
druplicon_drush_exit in commands/core/druplicon.drush.inc
Implements hook_drush_exit().
drush_choice in includes/drush.inc
Ask the user to select an item from a list. From a provided associative array, drush_choice will display all of the questions, numbered from 1 to N, and return the item the user selected. "0" is always cancel; entering a blank line is also…
drush_confirm in includes/drush.inc
Asks the user a basic yes/no question.
drush_core_global_options in commands/core/core.drush.inc

... See full list

File

includes/output.inc, line 26

Code

function drush_print($message = '', $indent = , $handle = NULL, $newline = TRUE) {
  $msg = str_repeat(' ', $indent) . (string) $message;
  if ($newline) {
    $msg .= "\n";
  }
  if (($charset = drush_get_option('output_charset')) && function_exists('iconv')) {
    $msg = iconv('UTF-8', $charset, $msg);
  }
  if (isset($handle)) {
    fwrite($handle, $msg);
  }
  else {
    print $msg;
  }
}