mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-07 08:27:12 +00:00
Gate prompt_input behind server feature flag
The function is only called from a #[cfg(feature = "server")] block, so it triggers a dead_code warning when compiled without the feature. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
38bc5c70b7
commit
2ddb8fdae3
1 changed files with 14 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ use arc_llm::provider::Provider;
|
|||
use axum::extract::Query;
|
||||
use axum::response::Html;
|
||||
use axum::routing::get;
|
||||
use dialoguer::{Confirm, Input, MultiSelect, Select};
|
||||
use dialoguer::{Confirm, MultiSelect, Password, Select};
|
||||
use rand::Rng;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::sync::oneshot;
|
||||
|
|
@ -277,9 +277,18 @@ fn prompt_confirm(prompt: &str, default: bool) -> Result<bool> {
|
|||
)
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
fn prompt_input(prompt: &str) -> Result<String> {
|
||||
Ok(
|
||||
Input::with_theme(&dialoguer::theme::ColorfulTheme::default())
|
||||
dialoguer::Input::with_theme(&dialoguer::theme::ColorfulTheme::default())
|
||||
.with_prompt(prompt)
|
||||
.interact_on(&dialoguer::console::Term::stderr())?,
|
||||
)
|
||||
}
|
||||
|
||||
fn prompt_password(prompt: &str) -> Result<String> {
|
||||
Ok(
|
||||
Password::with_theme(&dialoguer::theme::ColorfulTheme::default())
|
||||
.with_prompt(prompt)
|
||||
.interact_on(&dialoguer::console::Term::stderr())?,
|
||||
)
|
||||
|
|
@ -593,7 +602,7 @@ pub async fn run_install() -> Result<()> {
|
|||
eprintln!(" Get your API key at: {url}");
|
||||
|
||||
let prompt = env_var.to_string();
|
||||
let key: String = tokio::task::spawn_blocking(move || prompt_input(&prompt)).await??;
|
||||
let key: String = tokio::task::spawn_blocking(move || prompt_password(&prompt)).await??;
|
||||
env_pairs.push((env_var.to_string(), key));
|
||||
configured_providers.push(first_provider);
|
||||
}
|
||||
|
|
@ -631,7 +640,8 @@ pub async fn run_install() -> Result<()> {
|
|||
eprintln!(" Get your API key at: {url}");
|
||||
|
||||
let prompt = env_var.to_string();
|
||||
let key: String = tokio::task::spawn_blocking(move || prompt_input(&prompt)).await??;
|
||||
let key: String =
|
||||
tokio::task::spawn_blocking(move || prompt_password(&prompt)).await??;
|
||||
env_pairs.push((env_var.to_string(), key));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue