mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-19 15:14:21 +01:00
config: add optional extension description (#1743)
This commit is contained in:
@@ -504,15 +504,31 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
|
||||
.placeholder(&goose::config::DEFAULT_EXTENSION_TIMEOUT.to_string())
|
||||
.validate(|input: &String| match input.parse::<u64>() {
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err("Please enter a valide timeout"),
|
||||
Err(_) => Err("Please enter a valid timeout"),
|
||||
})
|
||||
.interact()?;
|
||||
|
||||
// Split the command string into command and args
|
||||
// TODO: find a way to expose this to the frontend so we dont need to re-write code
|
||||
let mut parts = command_str.split_whitespace();
|
||||
let cmd = parts.next().unwrap_or("").to_string();
|
||||
let args: Vec<String> = parts.map(String::from).collect();
|
||||
|
||||
let add_desc = cliclack::confirm("Would you like to add a description?").interact()?;
|
||||
|
||||
let description = if add_desc {
|
||||
let desc = cliclack::input("Enter a description for this extension:")
|
||||
.placeholder("Description")
|
||||
.validate(|input: &String| match input.parse::<String>() {
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err("Please enter a valid description"),
|
||||
})
|
||||
.interact()?;
|
||||
Some(desc)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let add_env =
|
||||
cliclack::confirm("Would you like to add environment variables?").interact()?;
|
||||
|
||||
@@ -542,6 +558,7 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
|
||||
cmd,
|
||||
args,
|
||||
envs: Envs::new(envs),
|
||||
description,
|
||||
timeout: Some(timeout),
|
||||
},
|
||||
})?;
|
||||
@@ -580,10 +597,25 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
|
||||
.placeholder(&goose::config::DEFAULT_EXTENSION_TIMEOUT.to_string())
|
||||
.validate(|input: &String| match input.parse::<u64>() {
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err("Please enter a valide timeout"),
|
||||
Err(_) => Err("Please enter a valid timeout"),
|
||||
})
|
||||
.interact()?;
|
||||
|
||||
let add_desc = cliclack::confirm("Would you like to add a description?").interact()?;
|
||||
|
||||
let description = if add_desc {
|
||||
let desc = cliclack::input("Enter a description for this extension:")
|
||||
.placeholder("Description")
|
||||
.validate(|input: &String| match input.parse::<String>() {
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err("Please enter a valid description"),
|
||||
})
|
||||
.interact()?;
|
||||
Some(desc)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let add_env =
|
||||
cliclack::confirm("Would you like to add environment variables?").interact()?;
|
||||
|
||||
@@ -612,6 +644,7 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
|
||||
name: name.clone(),
|
||||
uri,
|
||||
envs: Envs::new(envs),
|
||||
description,
|
||||
timeout: Some(timeout),
|
||||
},
|
||||
})?;
|
||||
|
||||
Reference in New Issue
Block a user