Author:
Hash:
Timestamp:
+9 -13 +/-1 browse
Kevin Schoon [me@kevinschoon.com]
0466aebbeef4dbc206b410655c4dd08bc3d2ac13
Sat, 01 Aug 2026 17:45:22 +0000 (1 month ago)
| 1 | diff --git a/ayllu-build/src/source.rs b/ayllu-build/src/source.rs |
| 2 | index dcb61cc..5e7dadf 100644 |
| 3 | --- a/ayllu-build/src/source.rs |
| 4 | +++ b/ayllu-build/src/source.rs |
| 5 | @@ -22,10 +22,8 @@ pub struct Resolved { |
| 6 | /// Source git repository which shall be built |
| 7 | #[derive(Clone, Debug)] |
| 8 | pub enum Source { |
| 9 | - /// Manifest piped through standard input |
| 10 | - Stdin, |
| 11 | /// Manifest file without a backing repository |
| 12 | - Manifest { path: PathBuf }, |
| 13 | + Manifest { path: Option<PathBuf> }, |
| 14 | /// Path to a git repository |
| 15 | Repository { |
| 16 | path: PathBuf, |
| 17 | @@ -42,12 +40,12 @@ pub enum Source { |
| 18 | impl Source { |
| 19 | pub fn from_arg(arg: Option<&str>) -> Result<Self, Error> { |
| 20 | match arg { |
| 21 | - Some("-") => Ok(Source::Stdin), |
| 22 | + Some("-") => Ok(Source::Manifest { path: None }), |
| 23 | Some(path) => { |
| 24 | let path = Path::new(&path); |
| 25 | if path.is_file() { |
| 26 | Ok(Source::Manifest { |
| 27 | - path: path.to_path_buf(), |
| 28 | + path: Some(path.to_path_buf()), |
| 29 | }) |
| 30 | } else { |
| 31 | let repository = |
| 32 | @@ -91,7 +89,6 @@ impl Source { |
| 33 | |
| 34 | pub fn reference(&self) -> Option<&String> { |
| 35 | match self { |
| 36 | - Source::Stdin => None, |
| 37 | Source::Manifest { .. } => None, |
| 38 | Source::Repository { reference, .. } => reference.as_ref(), |
| 39 | Source::Named { reference, .. } => reference.as_ref(), |
| 40 | @@ -130,7 +127,6 @@ impl Source { |
| 41 | Ok(Some(repo)) |
| 42 | } |
| 43 | Source::Manifest { path: _ } => Ok(None), |
| 44 | - Source::Stdin => Ok(None), |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | @@ -153,7 +149,12 @@ impl Source { |
| 49 | ) -> Result<Resolved, Error> { |
| 50 | tracing::info!("Reading manifest from source: {self:?}"); |
| 51 | let (manifest_raw_str, repository, git_info) = match self { |
| 52 | - Source::Manifest { path } => { |
| 53 | + Source::Manifest { path: None } => { |
| 54 | + let mut manifest_str = String::default(); |
| 55 | + std::io::stdin().read_to_string(&mut manifest_str)?; |
| 56 | + (manifest_str, None, None) |
| 57 | + } |
| 58 | + Source::Manifest { path: Some(path) } => { |
| 59 | let manifest_str = |
| 60 | std::fs::read_to_string(path).map_err(Error::CannotReadManifest)?; |
| 61 | (manifest_str, None, None) |
| 62 | @@ -185,11 +186,6 @@ impl Source { |
| 63 | )?; |
| 64 | (manifest_str, Some(repository), Some(git_info)) |
| 65 | } |
| 66 | - Source::Stdin => { |
| 67 | - let mut manifest_str = String::default(); |
| 68 | - std::io::stdin().read_to_string(&mut manifest_str)?; |
| 69 | - (manifest_str, None, None) |
| 70 | - } |
| 71 | }; |
| 72 | |
| 73 | let manifest_str = if let Some(pre_processor) = pre_processor.as_ref() { |