Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/commands/plug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,17 @@ impl PlugCommand {
let mut graph = CompositionGraph::new();

#[cfg(feature = "registry")]
let client = FileSystemClient::new_with_default_config(self.registry.as_deref()).ok();
let mut client = None;

let socket_path = match &self.socket {
#[cfg(feature = "registry")]
PackageRef::RegistryPackage((name, version)) => {
let client = client.as_ref().ok_or_else(|| {
if client.is_none() {
client = Some(FileSystemClient::new_with_default_config(
self.registry.as_deref(),
));
}
let client = client.as_ref().unwrap().as_ref().map_err(|_| {
anyhow::anyhow!(
"Warg registry is not configured. Package `{name}` was not found."
)
Expand Down Expand Up @@ -170,7 +175,12 @@ impl PlugCommand {
let (mut name, path) = match plug_ref {
#[cfg(feature = "registry")]
PackageRef::RegistryPackage((name, version)) => {
let client = client.as_ref().ok_or_else(|| {
if client.is_none() {
client = Some(FileSystemClient::new_with_default_config(
self.registry.as_deref(),
));
}
let client = client.as_ref().unwrap().as_ref().map_err(|_| {
anyhow::anyhow!(
"Warg registry is not configured. Package `{name}` was not found."
)
Expand Down