Skip to content

Commit

Permalink
refactor(libmake): 🎨 Refactor and decouple file generation logic
Browse files Browse the repository at this point in the history
decoupled the generator functions into separate files
  • Loading branch information
sebastienrousseau committed Mar 26, 2024
1 parent 92d653f commit 11eeae0
Show file tree
Hide file tree
Showing 23 changed files with 598 additions and 560 deletions.
2 changes: 1 addition & 1 deletion examples/generate_from_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
//! If there is an error, it will print an error message.
// Import the necessary function for generating files from arguments
use libmake::generator::generate_from_args;
use libmake::generators::args::generate_from_args;

/// A simple test program for the `generate_from_args` function.
///
Expand Down
4 changes: 2 additions & 2 deletions examples/generate_from_csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
//! ```
// Import the necessary function for generating templates from a CSV file.
use libmake::generator::generate_from_csv;
use libmake::generators::csv::generate_from_csv;

/// Attempts to generate template files from the specified CSV file.
///
Expand All @@ -48,7 +48,7 @@ use libmake::generator::generate_from_csv;
/// The following example demonstrates how to use the `generate_from_csv` function:
///
/// ```rust
/// use libmake::generator::generate_from_csv;
/// use libmake::generators::csv::generate_from_csv;
///
/// let csv_file_path = "./tests/data/mylibrary.csv";
///
Expand Down
2 changes: 1 addition & 1 deletion examples/generate_from_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
//! ```
// Import the necessary function for generating templates from a JSON file.
use libmake::generator::generate_from_json;
use libmake::generators::json::generate_from_json;

/// Generate template files based on the data in the JSON file.
///
Expand Down
2 changes: 1 addition & 1 deletion examples/generate_from_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//! ```
//!
// Import the necessary function for generating templates from a TOML file.
use libmake::generator::generate_from_toml;
use libmake::generators::toml::generate_from_toml;

/// Generate template files based on the configuration in the TOML file.
///
Expand Down
2 changes: 1 addition & 1 deletion examples/generate_from_yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//! ```
// Import the necessary function for generating templates from a YAML file.
use libmake::generator::generate_from_yaml;
use libmake::generators::yaml::generate_from_yaml;

/// Generate template files from the specified YAML file.
///
Expand Down
13 changes: 7 additions & 6 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
// Copyright © 2024 LibMake. All rights reserved.

use super::{
extract_param,
generator::{
generate_files, generate_from_csv, generate_from_ini,
generate_from_json, generate_from_toml, generate_from_yaml,
FileGenerationParams,
},
extract_param, generator::generate_files,
generators::csv::generate_from_csv,
generators::ini::generate_from_ini,
generators::json::generate_from_json,
generators::toml::generate_from_toml,
generators::yaml::generate_from_yaml,
models::model_params::FileGenerationParams,
};
use clap::ArgMatches;
use std::error::Error;
Expand Down
Loading

0 comments on commit 11eeae0

Please sign in to comment.