File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,23 @@ proc.aborted; // true
124
124
proc .killed ; // true
125
125
```
126
126
127
+ ### Using with command strings
128
+
129
+ If you need to continue supporting commands as strings (e.g. "command arg0 arg1"),
130
+ you can use [ args-tokenizer] ( https://github.com/TrySound/args-tokenizer ) ,
131
+ a lightweight library for parsing shell command strings into an array.
132
+
133
+ ``` ts
134
+ import {x } from ' tinyexec' ;
135
+ import {tokenizeArgs } from ' args-tokenizer' ;
136
+
137
+ const commandString = ' echo "Hello, World!"' ;
138
+ const [command, ... args] = tokenize (commandString );
139
+ const result = await x (command , args );
140
+
141
+ result .stdout ; // Hello, World!
142
+ ```
143
+
127
144
## API
128
145
129
146
Calling ` x(command[, args]) ` returns an awaitable ` Result ` which has the
You can’t perform that action at this time.
0 commit comments