|
84 | 84 | ] |
85 | 85 | }, |
86 | 86 | "execution_count": null, |
87 | | - "metadata": {}, |
| 87 | + "metadata": { |
| 88 | + "__type": "str" |
| 89 | + }, |
88 | 90 | "output_type": "execute_result" |
89 | 91 | } |
90 | 92 | ], |
|
122 | 124 | ] |
123 | 125 | }, |
124 | 126 | "execution_count": null, |
125 | | - "metadata": {}, |
| 127 | + "metadata": { |
| 128 | + "__type": "str" |
| 129 | + }, |
126 | 130 | "output_type": "execute_result" |
127 | 131 | } |
128 | 132 | ], |
|
260 | 264 | " except: return explain_exc(f'running cmd')\n", |
261 | 265 | " res = outp.stdout\n", |
262 | 266 | " if res and outp.stderr: res += '\\n'\n", |
263 | | - " return res + outp.stderr" |
| 267 | + " res += outp.stderr\n", |
| 268 | + " if not res.strip() and re.search(r'\\\\[|*?]', argstr):\n", |
| 269 | + " return r'Warning: no output and argstr contains \\-escaped chars. Shell escaping is not needed: try without \\-escaping.'\n", |
| 270 | + " return res\n" |
264 | 271 | ] |
265 | 272 | }, |
266 | 273 | { |
|
283 | 290 | "text": [ |
284 | 291 | "\u001b[34maai-ws\u001b[m\u001b[m\n", |
285 | 292 | "\u001b[34mApplications\u001b[m\u001b[m\n", |
286 | | - "autoexec.ipynb\n", |
287 | 293 | "\u001b[34mbooks\u001b[m\u001b[m\n", |
288 | 294 | "cachy.jsonl\n", |
289 | 295 | "\u001b[34mchats\u001b[m\u001b[m\n", |
290 | 296 | "CRAFT.ipynb\n", |
291 | | - "\u001b[34mDesktop\u001b\n" |
| 297 | + "CRAFT.py\n", |
| 298 | + "\u001b[34mCRAFTs\u001b[m\u001b[m\n", |
| 299 | + "\u001b\n" |
292 | 300 | ] |
293 | 301 | } |
294 | 302 | ], |
|
341 | 349 | "#| export\n", |
342 | 350 | "@llmtool\n", |
343 | 351 | "def rg(\n", |
344 | | - " argstr:str, # All args to the command, will be split with shlex\n", |
| 352 | + " argstr:str, # All args to the command, will be split with shlex. No shell escaping needed for regex chars like `|`\n", |
345 | 353 | " disallow_re:str=None, # optional regex which, if matched on argstr, will disallow the command\n", |
346 | 354 | " allow_re:str=None # optional regex which, if not matched on argstr, will disallow the command\n", |
347 | 355 | "):\n", |
|
362 | 370 | ] |
363 | 371 | }, |
364 | 372 | "execution_count": null, |
365 | | - "metadata": {}, |
| 373 | + "metadata": { |
| 374 | + "__type": "str" |
| 375 | + }, |
366 | 376 | "output_type": "execute_result" |
367 | 377 | } |
368 | 378 | ], |
|
498 | 508 | "#| export\n", |
499 | 509 | "@llmtool\n", |
500 | 510 | "def sed(\n", |
501 | | - " argstr:str, # All args to the command, will be split with shlex\n", |
| 511 | + " argstr:str, # All args to the command, will be split with shlex. No shell escaping needed for regex chars like `|`\n", |
502 | 512 | " disallow_re:str=None, # optional regex which, if matched on argstr, will disallow the command\n", |
503 | 513 | " allow_re:str=None # optional regex which, if not matched on argstr, will disallow the command\n", |
504 | 514 | "):\n", |
|
0 commit comments