From 01955c3aadd9224345da6eab55e4f4064ed357fb Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sat, 1 Jun 2024 22:25:24 -0700 Subject: [PATCH] Add examples --- README.md | 20 +++++++++++++++----- examples/echo.json | 8 ++++++++ examples/multiply.js | 1 + examples/multiply.json | 7 +++++++ 4 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 examples/echo.json create mode 100644 examples/multiply.js create mode 100644 examples/multiply.json diff --git a/README.md b/README.md index 30a919b..55001bc 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,13 @@ Transcriber is a [Bun](https://bun.sh/) CLI for executing combinations of shell commands. +The commands are run using [Bun Shell](https://bun.sh/docs/runtime/shell), which +implements its own set of +[built-in commands](https://bun.sh/docs/runtime/shell#builtin-commands). + ## Example -Given the following `input.json`: +Given the following `echo.json`: ```json { @@ -21,25 +25,31 @@ Given the following `input.json`: Do: ```plaintext -bun run index.ts -- --input input.json +bun run index.ts -- --input ./examples/echo.json + $ echo value1 value3 value5 value1 value3 value5 + $ echo value1 value3 value6 value1 value3 value6 + $ echo value1 value4 value5 value1 value4 value5 + $ echo value1 value4 value6 value1 value4 value6 + $ echo value2 value3 value5 value2 value3 value5 + $ echo value2 value3 value6 value2 value3 value6 + $ echo value2 value4 value5 value2 value4 value5 + $ echo value2 value4 value6 value2 value4 value6 ``` -The commands are run using [Bun Shell](https://bun.sh/docs/runtime/shell), which -implements its own set of -[built-in commands](https://bun.sh/docs/runtime/shell#builtin-commands). +More examples can be found within the **`/examples`** folder. diff --git a/examples/echo.json b/examples/echo.json new file mode 100644 index 0000000..daf253d --- /dev/null +++ b/examples/echo.json @@ -0,0 +1,8 @@ +{ + "command": "echo $arg1 $arg2 $arg3", + "args": { + "arg1": ["value1", "value2"], + "arg2": ["value3", "value4"], + "arg3": ["value5", "value6"] + } +} diff --git a/examples/multiply.js b/examples/multiply.js new file mode 100644 index 0000000..047e78d --- /dev/null +++ b/examples/multiply.js @@ -0,0 +1 @@ +console.log(process.env.arg1 * process.env.arg2); diff --git a/examples/multiply.json b/examples/multiply.json new file mode 100644 index 0000000..ce24fcb --- /dev/null +++ b/examples/multiply.json @@ -0,0 +1,7 @@ +{ + "command": "bun ./examples/multiply.js", + "args": { + "arg1": [1, 2], + "arg2": [7, 8] + } +} -- 2.47.3