Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 18 additions & 0 deletions src/global/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl CompletionsDir {
}

/// Prune old completions
#[cfg(unix)]
pub fn prune_old_completions(&self) -> miette::Result<()> {
for directory in [self.bash_path(), self.zsh_path(), self.fish_path()] {
if !directory.is_dir() {
Expand All @@ -55,6 +56,12 @@ impl CompletionsDir {
Ok(())
}

/// Prune old completions
#[cfg(not(unix))]
pub fn prune_old_completions(&self) -> miette::Result<()> {
Ok(())
}

pub fn bash_path(&self) -> PathBuf {
self.path().join("bash")
}
Expand Down Expand Up @@ -198,6 +205,7 @@ pub fn contained_completions(
/// based on the provided `exposed_mappings` and `executable_names`. It compares the
/// current state of the completion scripts in the `completions_dir` with the expected
/// state derived from the `exposed_mappings`.
#[cfg(unix)]
pub(crate) async fn completions_sync_status(
exposed_mappings: IndexSet<Mapping>,
executable_names: Vec<String>,
Expand Down Expand Up @@ -241,3 +249,13 @@ pub(crate) async fn completions_sync_status(

Ok((completions_to_remove, completions_to_add))
}

#[cfg(not(unix))]
pub(crate) async fn completions_sync_status(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can add a small comment ( from the PR overview ) to mention that we never install completions on windows that's why we don't need to check it here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

exposed_mappings: IndexSet<Mapping>,
executable_names: Vec<String>,
prefix_root: &Path,
completions_dir: &CompletionsDir,
) -> miette::Result<(Vec<Completion>, Vec<Completion>)> {
Ok((Vec::new(), Vec::new()))
}
10 changes: 10 additions & 0 deletions src/global/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,7 @@ impl Project {
Ok(state_changes)
}

#[cfg(unix)]
pub async fn sync_completions(
&self,
env_name: &EnvironmentName,
Expand Down Expand Up @@ -1294,6 +1295,15 @@ impl Project {
Ok(state_changes)
}

#[cfg(not(unix))]
pub async fn sync_completions(
&self,
env_name: &EnvironmentName,
) -> miette::Result<StateChanges> {
let mut state_changes = StateChanges::default();
Ok(state_changes)
}

/// Returns a semaphore than can be used to limit the number of concurrent
/// according to the user configuration.
fn concurrent_downloads_semaphore(&self) -> Arc<Semaphore> {
Expand Down