Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes unused (and unupdated) global version value, cleans up expectations around the "templates" folder #12

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hypnagogic_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct Args {
#[arg(short, long)]
output: Option<String>,
/// Location of the templates folder
#[arg(short, long, default_value_t = String::from("templates"))]
#[arg(short, long, default_value_t = String::from(hypnagogic_core::config::DEFAULT_TEMPLATE_LOCATION))]
templates: String,
/// List of space separated output directory/file(s)
#[arg(num_args = 1.., value_delimiter = ' ', required = true)]
Expand Down
2 changes: 1 addition & 1 deletion hypnagogic_core/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub mod blocks;
pub mod error;
pub mod template_resolver;

pub const LATEST_VERSION: &str = "1";
pub const DEFAULT_TEMPLATE_LOCATION: &str = "templates";

#[tracing::instrument(skip(resolver, input))]
pub fn read_config<R: Read + Seek>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use tracing::{debug, trace};

use crate::config::template_resolver::error::{TemplateError, TemplateResult};
use crate::config::template_resolver::TemplateResolver;
use crate::config::DEFAULT_TEMPLATE_LOCATION;

/// Loads templates from a folder on the filesystem.
#[derive(Clone, PartialEq, Eq, Debug)]
Expand All @@ -28,7 +29,8 @@ impl FileResolver {

impl Default for FileResolver {
fn default() -> Self {
FileResolver::new(Path::new("templates")).expect("templates folder does not exist")
FileResolver::new(Path::new(DEFAULT_TEMPLATE_LOCATION))
.unwrap_or_else(|_| panic!("{DEFAULT_TEMPLATE_LOCATION} folder does not exist"))
}
}

Expand Down
Loading