aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-02 22:30:15 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-02 22:30:15 -0600
commit50b6d0f63329900ed9e6730096a293aebd44e452 (patch)
tree557854e936a224063dbf4fb6b726b7cc0fd95159 /src/main.rs
parent4c9b1984bf1494d32715edb610d8c872e14ff115 (diff)
downloadmakers-50b6d0f63329900ed9e6730096a293aebd44e452.tar.gz
makers-50b6d0f63329900ed9e6730096a293aebd44e452.zip
refactor makefile reading into a separate module
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 2948818..8f48a5b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -30,7 +30,7 @@ mod args;
mod makefile;
use args::Args;
-use makefile::Makefile;
+use makefile::{Makefile, MakefileReader};
fn main() -> Result<()> {
jane_eyre::install()?;
@@ -60,15 +60,17 @@ fn main() -> Result<()> {
// TODO dump command-line args into MAKEFLAGS
// TODO dump command-line macros into environment
// TODO add SHELL macro
- let mut makefile = Makefile::new(&args);
+ let mut makefile_reader = MakefileReader::new(&args);
for filename in &args.makefile {
if filename == &PathBuf::from("-") {
- makefile.and_read(stdin().lock())?;
+ makefile_reader.and_read(stdin().lock())?;
} else {
- makefile.and_read_file(filename)?;
+ makefile_reader.and_read_file(filename)?;
};
}
+ let makefile: Makefile = makefile_reader.into();
+
if args.print_everything {
println!("{}", &makefile);
}