coder_format.php

Version 1.3 (checked in on 2008/02/24 at 19:40:50 by sun)

Coder format shell invocation script.

@param $filepath One or more files or directories containing the source code to process. If a directory is given, all files in that directory are processed recursively. Each file will be replaced with the formatted source code. Each original file is automatically backup to <filename>.coder.orig. @param --undo If the optional --undo argument is given, processed files are restored from their backups. Coder format automatically searches for the latest backup file (*.coder.orig) and each filename (without extension .coder.orig) is replaced with its backup file.

@usage php coder_format.php <filepath> [filepath] ... php coder_format.php <path> [path] ... php coder_format.php --undo <filepath> ... php coder_format.php --undo <path> ...

@example php coder_format.php modules/node/node.module php coder_format.php index.php modules/node/node.module php coder_format.php /home/drupal php coder_format.php /home/drupal/includes /home/drupal/modules php coder_format.php --undo modules/node/node.module php coder_format.php --undo /home/drupal

Important note for Windows users:

  • Ensure to encapsulate filename arguments with double quotes.

Functions

NameDescription
file_check_directoryCheck that the directory exists and is writable. Directories need to have execute permissions to be considered a directory by FTP servers, etc.
file_check_pathChecks path to see if it is a directory, or a dir/file.