Skip to main content

lux_cli/
which.rs

1use clap::Args;
2use eyre::Result;
3use lux_lib::{config::Config, lua_rockspec::LuaModule, package::PackageReq, which};
4
5#[derive(Args)]
6pub struct Which {
7    /// The module to search for.
8    module: LuaModule,
9    /// Only search in these packages.
10    packages: Option<Vec<PackageReq>>,
11}
12
13pub fn which(args: Which, config: Config) -> Result<()> {
14    let path = which::Which::new(args.module, &config)
15        .packages(args.packages.unwrap_or_default())
16        .search()?;
17    print!("{}", path.display());
18    Ok(())
19}