Backport #917 to Rojo 7.4.x branch (#947)

This commit is contained in:
Micah
2024-07-22 12:11:28 -07:00
committed by GitHub
parent 3b721242c1
commit 67b6a7e198
7 changed files with 138 additions and 73 deletions

View File

@@ -2,6 +2,7 @@ use std::path::PathBuf;
use anyhow::Context;
use clap::Parser;
use memofs::Vfs;
use crate::project::Project;
@@ -17,8 +18,11 @@ pub struct FmtProjectCommand {
impl FmtProjectCommand {
pub fn run(self) -> anyhow::Result<()> {
let vfs = Vfs::new_default();
vfs.set_watch_enabled(false);
let base_path = resolve_path(&self.project);
let project = Project::load_fuzzy(&base_path)?
let project = Project::load_fuzzy(&vfs, &base_path)?
.context("A project file is required to run 'rojo fmt-project'")?;
let serialized = serde_json::to_string_pretty(&project)