#patch #json #merge #cli-command #cli

app json-patch-cli

A CLI command to perform JSON RFC 6902 patching, merging and editing operations

6 releases

0.1.5 Nov 1, 2024
0.1.4 Nov 1, 2024
0.1.1 Oct 31, 2024

#283 in Parser implementations

Download history 441/week @ 2024-10-29 32/week @ 2024-11-05

473 downloads per month

MIT license

12KB
192 lines

json-patch-cli badge

A CLI command to perform JSON RFC 6902 patching, merging and editing operations.

This project provides a CLI command json-patch which uses the brilliant work from the json-patch crate.

Installation

cargo install --locked json-patch-cli

Usage

Usage: json-patch <COMMAND>

Commands:
  diff         Calculate the difference between two json files to create a JSON (RFC 6902) patch
  apply        Apply a JSON (RFC 6902) patch
  edit         Edit a JSON (RFC 6902) patch, by editing a patched version of the input using a text editor
  completions  Generate command line completions script
  help         Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help

diff Command

Calculate the difference between two json files to create a JSON (RFC 6902) patch

Usage: json-patch diff <FROM> <TO>

Arguments:
  <FROM>
  <TO>

Options:
  -h, --help           Print help

apply Command

Apply a JSON (RFC 6902) patch

Usage: json-patch apply --patch <PATCH> <INPUT>

Arguments:
  <INPUT>

Options:
  -p, --patch <PATCH>
  -h, --help           Print help

edit Command

Edit or create a JSON (RFC 6902) patch, by editing a patched version of the input using a text editor

Usage: json-patch edit [OPTIONS] --patch <PATCH> <INPUT>

Arguments:
  <INPUT>


Options:
  -w, --watch
          Enable live editing of the patch file

  -p, --patch <PATCH>
          Path to JSON patch file.

          If the patch file does not yet exist, this command will create a new one.

  -e, --editor <EDITOR>
          [default: vim]

  -h, --help
          Print help (see a summary with '-h')

Dependencies

~5–15MB
~204K SLoC