style: use default index name constant

This commit is contained in:
daimond113 2024-10-14 23:28:02 +02:00
parent 73a63c3664
commit beaf143679
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C

View file

@ -1,6 +1,6 @@
use crate::cli::config::read_config; use crate::cli::config::read_config;
use clap::{Args, Subcommand}; use clap::{Args, Subcommand};
use pesde::{errors::ManifestReadError, Project}; use pesde::{errors::ManifestReadError, Project, DEFAULT_INDEX_NAME};
mod login; mod login;
mod logout; mod logout;
@ -51,11 +51,11 @@ impl AuthSubcommand {
let index_url = match index_url { let index_url = match index_url {
Some(url) => url, Some(url) => url,
None => { None => {
let index_name = self.index.as_deref().unwrap_or("default"); let index_name = self.index.as_deref().unwrap_or(DEFAULT_INDEX_NAME);
match manifest.unwrap().indices.get(index_name) { match manifest.unwrap().indices.get(index_name) {
Some(index) => index.clone(), Some(index) => index.clone(),
None => anyhow::bail!("index {index_name} not found"), None => anyhow::bail!("index {index_name} not found in manifest"),
} }
} }
}; };