gptscript
gptscript copied to clipboard
Builtin support for appending to a file (similar to write file).
Builtin support for appending to a file would be helpful when there is a need to write to the same file with in a loop.
I tried the following gptscript to get a file with all acorn commands with their help text.
Using sys.write in this case resulted in output file having help for only 1 acorn command which is as expected.
tools: listacorncommands, acornhelpandwrite
List all acorn commands. For each acorn commands from this list , get help text and write the help text to a file acornhelp.txt
---
name: acornhelpandwrite
description: get help text for acorn commands and write to file
tools: sys.write, acornhelp
args: command: acorn command
args: file: file name
get help text for acorn commands and write to a file
---
name: acornhelp
description: get help text for acorn commands
args: command: acorn command
#!/bin/bash
acorn help ${command}
---
name: listacorncommands
description: List all acorn commands
#!/bin/bash
acorn help
It would be helpful to have sys.append in this case.