nestrs-cli-rs 0.1.0

Rust port of the Nest CLI for the nestrs organization.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Upstream source: `../nest-cli/lib/utils/load-configuration.ts`.

use std::path::Path;

use crate::Result;
use crate::configuration::{Configuration, ConfigurationLoader, NestConfigurationLoader};
use crate::readers::FileSystemReader;

pub fn load_configuration() -> Result<Configuration> {
    let cwd = std::env::current_dir()?;
    NestConfigurationLoader::new(FileSystemReader::new(cwd)).load(None)
}

pub fn load_configuration_from(directory: impl AsRef<Path>) -> Result<Configuration> {
    NestConfigurationLoader::new(FileSystemReader::new(directory.as_ref())).load(None)
}