Skip to content

Instantly share code, notes, and snippets.

@sillero
Last active July 8, 2018 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sillero/0293ac86e3f6224b7ff1c079b1fa2a67 to your computer and use it in GitHub Desktop.
Save sillero/0293ac86e3f6224b7ff1c079b1fa2a67 to your computer and use it in GitHub Desktop.
extend-json CLI
#!/bin/bash
TARGET=$(tr -d '\n' < $1)
SOURCE=$(tr -d '\n' < $2)
node -e "console.log(JSON.stringify({ ...$TARGET, ...$SOURCE }, false, 4))"

Requires nodejs

Usage:

# extend-json <target-path> <source-path>

extend-json a/package.json b/package.json > a/package.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment