On the linux command line, using bash, we can easily create an executable php file and symlink to it from the /usr/bin path. Doing so will add coder_format as an executable command at the bash prompt.
In order to do this though, we need to change $_SERVER['PHP_SELF'], which points to the executed command, to the constant __FILE__. If this isn't done, we cannot include the coder_format.php file in our bash executable and have it work when symlinked.
Please refer to my attached patch, which doesn't break anything currently used in Windows or Linux, and the attached tarball containing the shell executable php code file.
If this is accepted, I'd be happy to also ammend the README.txt documentation to include suggested installation steps for coder-format.phps. For me I did this:
-
Make the shell file executable
$ chmod 755 scripts/coder_format/coder-format.phps -
Link to it from /usr/bin
$ ln -sT /var/www/drupal6/sites/all/modules/coder/scripts/coder_format/coder-format.phps /usr/bin/coder-format
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | coder-format-linux-cli.patch | 1.13 KB | chop |
| #2 | coder-format-linux-cli.patch | 828 bytes | chop |
| #2 | coder-format-linux-cli.tgz | 186 bytes | chop |
Comments
Comment #1
chop commentedAnyone want to review my patch? Forgot to set appropriate status.
Comment #2
chop commentedHere's the patch. It didn't upload the first time.
Comment #3
chop commentedI've re-rolled my patch, with the added file now included (instead of in a separate tarball).
Comment #4
sunThanks! Instead of this, I've just committed a Drush
coder-formatcommand:http://drupalcode.org/project/coder.git/commit/6547a06