1use eyre::Result;
2use lux_lib::{
3 config::Config,
4 operations::{Exec, Install, PackageInstallSpec},
5 progress::MultiProgress,
6 project::Project,
7 tree,
8};
9
10pub async fn check(config: Config) -> Result<()> {
11 let project = Project::current_or_err()?;
12
13 let luacheck =
14 PackageInstallSpec::new("luacheck".parse()?, tree::EntryType::Entrypoint).build();
15
16 Install::new(&config)
17 .package(luacheck)
18 .project(&project)?
19 .progress(MultiProgress::new_arc())
20 .install()
21 .await?;
22
23 Exec::new("luacheck", Some(&project), &config)
24 .arg(project.root().to_string_lossy())
25 .arg("--exclude-files")
26 .arg(project.tree(&config)?.root().to_string_lossy())
27 .exec()
28 .await?;
29
30 Ok(())
31}