summaryrefslogtreecommitdiff
path: root/src/driver.rs
diff options
context:
space:
mode:
authorNick Gerace <nickagerace@gmail.com>2021-05-16 18:53:08 -0400
committerNick Gerace <nickagerace@gmail.com>2021-05-16 18:56:04 -0400
commitf0449e5f9eb05684cd819901165c0b632a8c5e0e (patch)
tree95c4266d6753a7807e1263303785b99e0c5eda87 /src/driver.rs
parent7440a7e16ff5e7b7588a12c8095b36554c5212b1 (diff)
downloadgfold-f0449e5f9eb05684cd819901165c0b632a8c5e0e.zip
Remove middleware run function in library
Diffstat (limited to 'src/driver.rs')
-rw-r--r--src/driver.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/driver.rs b/src/driver.rs
index 4f5a081..c92599b 100644
--- a/src/driver.rs
+++ b/src/driver.rs
@@ -1,5 +1,5 @@
-//! This module contains the types required for using `gfold::run`.
-use crate::{internal_types, util};
+//! This module contains the types required for generating results for `gfold`.
+use crate::{driver_internal::TableWrapper, util};
use anyhow::Result;
use log::{debug, warn};
use std::{
@@ -8,7 +8,7 @@ use std::{
path::{Path, PathBuf},
};
-/// A bedrock type that is a required parameter for `gfold::run`.
+/// A bedrock type that is a required parameter when creating a new `Driver`.
#[derive(Debug)]
pub struct Config {
/// Enable checking for unpushed commits (experimental).
@@ -26,22 +26,22 @@ pub struct Config {
}
/// Creating this object with a given `Config` will generate results that can be printed to `STDOUT`.
-pub struct Results(Vec<internal_types::TableWrapper>);
+pub struct Driver(Vec<TableWrapper>);
-impl Results {
- /// Generate `Results` with a given configuration.
- pub fn new(path: &Path, config: &Config) -> Result<Results> {
+impl Driver {
+ /// Constructing a `Driver` will generate results with a given `&Path` and `&Config`.
+ pub fn new(path: &Path, config: &Config) -> Result<Driver> {
debug!("Running with config: {:#?}", &config);
debug!("Running in path: {:#?}", &path);
- let mut results = Results(Vec::new());
- results.execute_in_directory(&config, path)?;
+ let mut driver = Driver(Vec::new());
+ driver.execute_in_directory(&config, path)?;
if !&config.skip_sort {
- results.sort_results();
+ driver.sort_results();
}
- Ok(results)
+ Ok(driver)
}
- /// Print results to STDOUT after generation.
+ /// Print results to `STDOUT` after generation.
pub fn print_results(self) {
debug!("Printing results with {} tables...", self.0.len());
match self.0.len().cmp(&1) {