1use anyhow::Result;
5use std::path::{Path, PathBuf};
6
7pub fn resolve(workspace: Option<&Path>, all_workspaces: bool) -> Result<Vec<PathBuf>> {
8 let primary = crate::core::workspace::resolve(workspace)?;
9 if all_workspaces {
10 return crate::core::workspace::machine_workspaces(Some(&primary));
11 }
12 Ok(vec![primary])
13}
14
15pub fn label(roots: &[PathBuf]) -> String {
16 if roots.len() == 1 {
17 return roots[0].to_string_lossy().to_string();
18 }
19 format!("machine:{} workspaces", roots.len())
20}
21
22pub fn decorate_path(workspace: &Path, path: &str) -> String {
23 format!("{}:{}", workspace.to_string_lossy(), path)
24}