pavex_cli 0.2.10

The companion CLI for Pavex, a Rust framework to build API services and web applications.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::locator::PavexLocator;
use crate::pavexc::get_or_install_from_version;
use crate::state::State;
use std::path::PathBuf;

/// Retrieve the path to the default `pavexc` binary, according to the value of
/// the default toolchain.
///
/// This is primarily used when executing `pavex` commands that don't operate within the
/// context of a Pavex project—e.g. `pavex new`.
/// Otherwise the toolchain is determined by the project's `pavex` library crate version.
pub fn get_default_pavexc(locator: &PavexLocator, state: &State) -> Result<PathBuf, anyhow::Error> {
    let version = state.get_current_toolchain()?;
    let pavexc_cli_path = get_or_install_from_version(locator, &version)?;
    Ok(pavexc_cli_path)
}