From 1742da02f757c729ef73d4acac724ab073518885 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Wed, 26 Dec 2018 14:34:24 +0700 Subject: [PATCH] Update docs.md --- docs.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs.md b/docs.md index d4f1035..ad347c6 100644 --- a/docs.md +++ b/docs.md @@ -122,6 +122,27 @@ curl 'https://api.github.com/repos/facebook/react/commits?per_page=100' \ > export NODE_PATH=/usr/local/lib/node_modules > ``` +## Edit in place + +Add next code to your _.fxrc_ file: + +```js +const fx = require('fs') + +global.save = json => { + fs.writeFileSync(process.argv[2], JSON.stringify(json, null, 2)) + return json +} +``` + +Usage: + +```bash +fx data.json '{...this, count: this.count+1}' save .count +``` + + + ## Formatting If you need something different then JSON (for example arguments for xargs) do not return anything from reducer.