aboutsummaryrefslogtreecommitdiffstats
path: root/tools/save_file.sh
blob: f2d14d03d7660ef591ab21bc08a931f7043e0a5b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash
set -e

# @describe Saves the contents to a file called `file_name` and returns the file path if successful.
# @option --file-name! The name of the file to save to.
# @option --contents! The contents to save.

main() {
    base_dir="${LLM_TOOL_CACHE_DIR:-/tmp}"
    output_file="$base_dir/$argc_file_name"
    mkdir -p "$(dirname "$output_file")"
    echo "$argc_contents" > "$output_file"
    echo "$output_file"
}

eval "$(argc --argc-eval "$0" "$@")"