From 9851317aeb4a78df4ccf22f10629142f3f47d67b Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Sun, 1 Dec 2019 17:39:09 +0100 Subject: [PATCH] add documentation for default command --- docs/commands/default.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docs/commands/default.md diff --git a/docs/commands/default.md b/docs/commands/default.md new file mode 100644 index 0000000000..b08c6d3443 --- /dev/null +++ b/docs/commands/default.md @@ -0,0 +1,36 @@ +# default + +This command sets a default row's column if missing. Other commands are capable of feeding `default` with their output through pipelines. + +## Usage +```shell +> [input-command] | default [column-name] [column-value] +``` + +## Examples + +Let's say we have a table like this: + +```shell +> open contacts.json +━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━ + # │ name │ email +───┼──────────┼────────────────── + 0 │ paul │ paul@example.com + 1 │ andres │ + 2 │ jonathan │ +━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━ +``` + +`default` allows us to fill `email` column with a default value: + +```shell +> open contacts.json | default email "no-reply@example.com" +━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━ + # │ name │ email +───┼──────────┼────────────────────── + 0 │ paul │ paul@example.com + 1 │ andres │ no-reply@example.com + 2 │ jonathan │ no-reply@example.com +━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━ +```