diff --git a/README.md b/README.md index dc17106..6c012a9 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,23 @@ proc.aborted; // true proc.killed; // true ``` +### Using with command strings + +If you need to continue supporting commands as strings (e.g. "command arg0 arg1"), +you can use [args-tokenizer](https://github.com/TrySound/args-tokenizer), +a lightweight library for parsing shell command strings into an array. + +```ts +import {x} from 'tinyexec'; +import {tokenizeArgs} from 'args-tokenizer'; + +const commandString = 'echo "Hello, World!"'; +const [command, ...args] = tokenize(commandString); +const result = await x(command, args); + +result.stdout; // Hello, World! +``` + ## API Calling `x(command[, args])` returns an awaitable `Result` which has the