function drush_print_file

8.0.x output.inc drush_print_file($file)
6.x output.inc drush_print_file($file)
7.x output.inc drush_print_file($file)
4.x drush.inc drush_print_file($file)
5.x output.inc drush_print_file($file)
master output.inc drush_print_file($file)

Print the contents of a file.

Parameters

string $file: Full path to a file.

Related topics

3 calls to drush_print_file()
drush_docs_errorcodes in commands/core/docs.drush.inc
docs-errorcodes command. Print a list of all error codes that can be found.
drush_engine_topic_command in includes/engines.inc
Implementation of command hook for docs-output-formats
Project::getReleaseNotes in lib/Drush/UpdateService/Project.php
Prints release notes for given projects.
4 string references to 'drush_print_file'
cli_drush_command in commands/core/cli.drush.inc
Implements hook_drush_command().
docs_drush_command in commands/core/docs.drush.inc
Implementation of hook_drush_command().
make_drush_command in commands/make/make.drush.inc
Implements hook_drush_command().
sandwich_drush_command in examples/sandwich.drush.inc
Implements hook_drush_command().

File

includes/output.inc, line 697

Code

function drush_print_file($file) {
  // Don't even bother to print the file in --no mode
  if (drush_get_context('DRUSH_NEGATIVE')) {
    return;
  }
  if ((substr($file, -4) == ".htm") || (substr($file, -5) == ".html")) {
    $tmp_file = drush_tempnam(basename($file));
    file_put_contents($tmp_file, drush_html_to_text(file_get_contents($file)));
    $file = $tmp_file;
  }
  // Do not wait for user input in --yes or --pipe modes
  if (drush_get_context('DRUSH_PIPE')) {
    drush_print_pipe(file_get_contents($file));
  }
  elseif (drush_get_context('DRUSH_AFFIRMATIVE')) {
    drush_print(file_get_contents($file));
  }
  elseif (drush_shell_exec_interactive("less %s", $file)) {
    return;
  }
  elseif (drush_shell_exec_interactive("more %s", $file)) {
    return;
  }
  else {
    drush_print(file_get_contents($file));
  }
}