openpencil/crates/op-cli/src/path_args.rs
Kayshen-X 9edc9f71c3 feat(cli): expand CLI command and flag surface
Add CLI path-args, file-flag, selection and design command coverage matching the expanded MCP tool surface, with tests and usage text.
2026-06-02 09:42:06 +08:00

19 lines
549 B
Rust

use std::path::PathBuf;
pub(crate) fn resolve_file_path_arg(value: &str) -> String {
if value.starts_with("live://") {
return value.to_string();
}
let path = PathBuf::from(value);
if path.is_absolute() {
return path.display().to_string();
}
std::env::current_dir()
.map(|cwd| cwd.join(path).display().to_string())
.unwrap_or_else(|_| value.to_string())
}
pub(crate) fn resolve_file_path_value(value: &str) -> serde_json::Value {
serde_json::Value::String(resolve_file_path_arg(value))
}