refactor: move gitea out of the way
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
mod cli;
|
||||
mod config_file;
|
||||
mod execution_env;
|
||||
mod source;
|
||||
mod stdin;
|
||||
|
||||
pub use cli::ConfigArgs;
|
||||
pub(crate) use config_file::get_config_from_config_file;
|
||||
pub(crate) use execution_env::get_from_environment;
|
||||
pub(crate) use source::get_source;
|
||||
pub(crate) use stdin::get_config_from_stdin;
|
||||
|
13
crates/cuddle-please-frontend/src/gatheres/source.rs
Normal file
13
crates/cuddle-please-frontend/src/gatheres/source.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use std::path::Path;
|
||||
|
||||
use crate::stage0_config;
|
||||
|
||||
pub fn get_source(source: &Path) -> stage0_config::PleaseConfigBuilder {
|
||||
stage0_config::PleaseConfigBuilder {
|
||||
project: Some(stage0_config::PleaseProjectConfigBuilder {
|
||||
source: Some(source.to_path_buf()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
@@ -48,6 +48,7 @@ pub struct PleaseConfigBuilder {
|
||||
execution_env: Option<stage0_config::PleaseConfigBuilder>,
|
||||
cli: Option<stage0_config::PleaseConfigBuilder>,
|
||||
config: Option<stage0_config::PleaseConfigBuilder>,
|
||||
source: Option<stage0_config::PleaseConfigBuilder>,
|
||||
}
|
||||
|
||||
impl PleaseConfigBuilder {
|
||||
@@ -80,8 +81,20 @@ impl PleaseConfigBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_source(&mut self, source: &Path) -> &mut Self {
|
||||
self.source = Some(gatheres::get_source(source));
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(&mut self) -> anyhow::Result<PleaseConfig> {
|
||||
let gathered = vec![&self.execution_env, &self.config, &self.stdin, &self.cli];
|
||||
let gathered = vec![
|
||||
&self.execution_env,
|
||||
&self.source,
|
||||
&self.config,
|
||||
&self.stdin,
|
||||
&self.cli,
|
||||
];
|
||||
|
||||
let final_config = gathered
|
||||
.into_iter()
|
||||
|
Reference in New Issue
Block a user