aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-11-29 16:07:39 +1300
committerTom Ryder <tom@sanctum.geek.nz>2019-11-29 16:07:39 +1300
commite762715f3e7f0e9e6f861509872b1b6a5e2fa9d3 (patch)
tree6d5eb76f8218b7bc92b7f3cc3d046e1d82006a1e
parentMerge branch 'release/v7.21.0' into develop (diff)
downloaddotfiles-e762715f3e7f0e9e6f861509872b1b6a5e2fa9d3.tar.gz
dotfiles-e762715f3e7f0e9e6f861509872b1b6a5e2fa9d3.zip
Add phpcsff(1df)
-rw-r--r--.gitignore3
-rw-r--r--Makefile4
-rw-r--r--README.md3
-rwxr-xr-xbin/phpcsff.mi515
4 files changed, 25 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index a6b9e0e3..8dbb1aba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -85,6 +85,9 @@
/bin/pa
/bin/paz
/bin/ped
+/bin/phpcsff
+/bin/phpcsff.m4
+/bin/phpcsff.sh
/bin/pit
/bin/plmu
/bin/pp
diff --git a/Makefile b/Makefile
index 6902c146..814cd41a 100644
--- a/Makefile
+++ b/Makefile
@@ -170,6 +170,7 @@ BINS = bin/ap \
bin/pa \
bin/paz \
bin/ped \
+ bin/phpcsff \
bin/pit \
bin/plmu \
bin/p \
@@ -234,6 +235,7 @@ BINS_M4 = bin/chn.m4 \
bin/edda.m4 \
bin/mim.m4 \
bin/oii.m4 \
+ bin/phpcsff.m4 \
bin/pst.m4 \
bin/swr.m4 \
bin/tlcs.m4 \
@@ -245,6 +247,7 @@ BINS_SH = bin/chn.sh \
bin/edda.sh \
bin/mim.sh \
bin/oii.sh \
+ bin/phpcsff.sh \
bin/pst.sh \
bin/swr.sh \
bin/tlcs.sh \
@@ -319,6 +322,7 @@ bin/dfv.sh: bin/dfv.m4 include/mktd.m4
bin/edda.sh: bin/edda.m4 include/mktd.m4
bin/mim.sh: bin/mim.m4 include/mktd.m4
bin/oii.sh: bin/oii.m4 include/mktd.m4
+bin/phpcsff.sh: bin/phpcsff.m4 include/mktd.m4
bin/pst.sh: bin/pst.m4 include/mktd.m4
bin/swr.sh: bin/swr.m4 include/mktd.m4
bin/tlcs.sh: bin/tlcs.m4 include/mktd.m4
diff --git a/README.md b/README.md
index 6c53c211..074b08b1 100644
--- a/README.md
+++ b/README.md
@@ -550,6 +550,9 @@ Installed by the `install-bin` target:
* `p(1df)` prints concatenated standard input; `cat(1)` as it should always
have been.
* `pa(1df)` prints its arguments, one per line.
+* `phpcsff(1df)` wraps around
+ [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to make it
+ a source code filter suitable for use as an `equalprg` in Vim.
* `pp(1df)` prints the full path of each argument using `$PWD`.
* `pph(1df)` runs `pp(1df)` and includes a leading `$HOSTNAME:`.
* `paz(1df)` print its arguments terminated by NULL chars.
diff --git a/bin/phpcsff.mi5 b/bin/phpcsff.mi5
new file mode 100755
index 00000000..ea05eaaa
--- /dev/null
+++ b/bin/phpcsff.mi5
@@ -0,0 +1,15 @@
+# Use php-cs-fixer as a source filter.
+self=phpcsff
+
+<%
+include(`include/mktd.m4')
+%>
+
+# Duplicate stdin into a file
+if ! command -v php-cs-fixer >/dev/null 2>&1 ; then
+ printf >&2 'php-cs-fixer: command not found\n'
+ exit 1
+fi
+cat -- "${@:--}" > "$td"/src.php
+php-cs-fixer fix -- "$td"/src.php
+cat -- "$td"/src.php