From 2611d16b354f0f0881ee8f4b66f138da4fd002e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?imme=C3=ABmosol?= Date: Sun, 13 Oct 2024 11:01:43 +0200 Subject: [PATCH] docs: document check/diff example for stdio usage (#325) --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e5750f8..2ffc0b8 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,12 @@ To read from `stdin` and output the result to `stdout` use the `--stdin` flag. $ cat package.json | sort-package-json --stdin ``` +This can, for instance, be used to generate a diff before changing `package.json`. + +```bash +$ ( PKG="./package.json" ; cat "${PKG?}" | sort-package-json --stdin | diff "${PKG?}" - ; ) +``` + ## API ### Install