mirror of
https://github.com/SilasMarvin/lsp-ai.git
synced 2025-12-18 15:04:29 +01:00
45 lines
914 B
Rust
45 lines
914 B
Rust
//! See <https://github.com/matklad/cargo-xtask/>.
|
|
//!
|
|
//! This binary defines various auxiliary build commands, which are not
|
|
//! expressible with just `cargo`.
|
|
//!
|
|
//! This binary is integrated into the `cargo` command line by using an alias in
|
|
//! `.cargo/config`.
|
|
|
|
#![warn(
|
|
rust_2018_idioms,
|
|
unused_lifetimes,
|
|
semicolon_in_expressions_from_macros
|
|
)]
|
|
|
|
mod flags;
|
|
|
|
mod dist;
|
|
|
|
use std::{
|
|
env,
|
|
path::{Path, PathBuf},
|
|
};
|
|
use xshell::Shell;
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
let flags = flags::Xtask::from_env_or_exit();
|
|
|
|
let sh = &Shell::new()?;
|
|
sh.change_dir(project_root());
|
|
|
|
match flags.subcommand {
|
|
flags::XtaskCmd::Dist(cmd) => cmd.run(sh),
|
|
}
|
|
}
|
|
|
|
fn project_root() -> PathBuf {
|
|
Path::new(
|
|
&env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| env!("CARGO_MANIFEST_DIR").to_owned()),
|
|
)
|
|
.ancestors()
|
|
.nth(1)
|
|
.unwrap()
|
|
.to_path_buf()
|
|
}
|