Skip to content
Open
Show file tree
Hide file tree
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
37 changes: 18 additions & 19 deletions crates/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,44 +369,43 @@ fn node_names_completer(current: &std::ffi::OsStr) -> Vec<CompletionCandidate> {
tokio::task::block_in_place(|| {
let handle = Handle::current();
let modifiers = SubCommandModifiers::default();
let mut completions = vec![];

if current.is_empty() || current == "-" {
completions.push(
CompletionCandidate::new("-").help(Some("Read stdin as --on arguments".into())),
);
}

let Ok(current_dir) = std::env::current_dir() else {
return completions;
return Vec::new();
};

let Ok(hive_location) = handle.block_on(get_hive_location(
current_dir.display().to_string(),
modifiers,
)) else {
return completions;
return Vec::new();
};

let Some(current) = current.to_str() else {
return completions;
return Vec::new();
};

if current.starts_with('@') {
return vec![];
return Vec::new();
}

if let Ok(names) =
handle.block_on(async { get_hive_node_names(&hive_location, modifiers).await })
{
for name in names {
if name.starts_with(current) {
completions.push(CompletionCandidate::new(name));
gen {
if current.is_empty() || current == "-" {
yield CompletionCandidate::new("-")
.help(Some("Read stdin as --on arguments".into()));
}

if let Ok(names) =
handle.block_on(async { get_hive_node_names(&hive_location, modifiers).await })
{
for name in names {
if name.starts_with(current) {
yield CompletionCandidate::new(name);
}
}
}
}

completions
.collect()
})
}

Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#![deny(clippy::pedantic)]
#![feature(default_field_values)]
#![feature(gen_blocks)]

use std::process::Command;
use std::sync::Arc;
Expand Down
29 changes: 15 additions & 14 deletions crates/core/src/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,22 +506,23 @@ where
previous_rowid = evaluation_paths.last().map_or(previous_rowid, |r| r.rowid);

// build list of all store paths to check
let mut all_paths: Vec<SafeStorePath<String>> = Vec::new();

for path in &evaluation_paths {
if let Ok(p) = SafeStorePath::<String>::from_name_and_digest(
&path.flake_path_name,
&path.flake_path_digest,
) {
all_paths.push(p);
}
if let Ok(p) = SafeStorePath::<String>::from_name_and_digest(
&path.output_path_name,
&path.output_path_digest,
) {
all_paths.push(p);
let all_paths: Vec<SafeStorePath<String>> = gen {
for path in &evaluation_paths {
if let Ok(p) = SafeStorePath::<String>::from_name_and_digest(
&path.flake_path_name,
&path.flake_path_digest,
) {
yield p;
}
if let Ok(p) = SafeStorePath::<String>::from_name_and_digest(
&path.output_path_name,
&path.output_path_digest,
) {
yield p;
}
}
}
.collect();

// query which cached paths are valid in the nix store
let valid_paths = match client.query_valid_paths(all_paths.clone(), false).await {
Expand Down
11 changes: 5 additions & 6 deletions crates/core/src/commands/pty/logbuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ impl LogBuffer {

#[cfg(test)]
fn take_lines(&mut self) -> Vec<Vec<u8>> {
let mut lines = vec![];

while let Some(line) = self.next_line() {
lines.push(line);
gen {
while let Some(line) = self.next_line() {
yield line;
}
}

lines
.collect()
}
}

Expand Down
47 changes: 26 additions & 21 deletions crates/core/src/hive/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,35 @@ impl Target {
modifiers: SubCommandModifiers,
force_quiet: bool,
) -> Result<Vec<String>, HiveLibError> {
let mut vector = vec![
"-l".to_string(),
self.user.to_string(),
"-p".to_string(),
self.port.to_string(),
];
let mut options = vec![format!(
"StrictHostKeyChecking={}",
match modifiers.ssh_accept_host {
StrictHostKeyChecking::AcceptNew => "accept-new",
StrictHostKeyChecking::No => "no",
}
)];

options.extend(["BatchMode=yes".to_string()]);
let vector: Vec<String> = gen {
yield "-l".to_string();
yield self.user.to_string();
yield "-p".to_string();
yield self.port.to_string();

let options = [
format!(
"StrictHostKeyChecking={}",
match modifiers.ssh_accept_host {
StrictHostKeyChecking::AcceptNew => "accept-new",
StrictHostKeyChecking::No => "no",
}
),
"BatchMode=yes".to_string(),
];

vector.push("-o".to_string());
vector.extend(options.into_iter().intersperse("-o".to_string()));
for option in options {
yield "-o".to_string();
yield option;
}

if force_quiet {
vector.push("-q".to_string());
} else if modifiers.ssh_verbosity > 0 {
vector.push(format!("-{}", "v".repeat(modifiers.ssh_verbosity)));
if force_quiet {
yield "-q".to_string();
} else if modifiers.ssh_verbosity > 0 {
yield format!("-{}", "v".repeat(modifiers.ssh_verbosity));
}
}
.collect();

Ok(vector)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright 2024-2025 wire Contributors

#![feature(iter_intersperse)]
#![feature(sync_nonpoison)]
#![feature(nonpoison_mutex)]
#![feature(default_field_values)]
#![feature(gen_blocks)]

use std::{
collections::{HashMap, HashSet},
Expand Down
Loading