From 0b2409aaf2bc2fa144df144b843d9aaac68eb9c0 Mon Sep 17 00:00:00 2001
From: Nathan Broadbent
Date: Fri, 16 Dec 2022 14:13:56 +1300
Subject: [PATCH] Don't require quotes around the prompt arg, allow multiple
args to be joined with " "
---
src/main.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 83879ad..c43ada1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -11,7 +11,7 @@ use std::{env, process::Command};
#[command(author, version, about, long_about = None)]
struct Cli {
/// Description of the command to execute
- prompt: String,
+ prompt: Vec,
/// Run the generated program without asking for confirmation
#[clap(short = 'y', long)]
@@ -38,7 +38,7 @@ fn main() {
"presence_penalty": 0,
"frequency_penalty": 0,
"model": "text-davinci-003",
- "prompt": format!("{}:\n```bash\n#!/bin/bash\n", cli.prompt),
+ "prompt": format!("{}:\n```bash\n#!/bin/bash\n", cli.prompt.join(" ")),
}))
.header("Authorization", format!("Bearer {}", api_key))
.send()