diff --git a/src/app.rs b/src/app.rs index 90882a4..e2e8e64 100644 --- a/src/app.rs +++ b/src/app.rs @@ -15,7 +15,7 @@ pub fn update(base_config: &Config, new_version: &Version) -> Result<()> { &("current_version = \"{{current_version}}\"".to_string()), &("current_version = \"{{new_version}}\"".to_string()), ); - for f in base_config.get_files() { + for f in &base_config.files { writer.add_target(&f.path, &f.search, &f.replace); } diff --git a/src/commands/info.rs b/src/commands/info.rs index 696688a..22d3dfd 100644 --- a/src/commands/info.rs +++ b/src/commands/info.rs @@ -19,7 +19,7 @@ pub(crate) fn execute(_args: &Arguments, config: &Config) -> Result<()> { ctx.insert("next_major", &versioning::up_major(&config.current_version)); ctx.insert("next_minor", &versioning::up_minor(&config.current_version)); ctx.insert("next_patch", &versioning::up_patch(&config.current_version)); - for f in config.get_files() { + for f in &config.files { files.push(f.path.display().to_string()); } ctx.insert("files", &files); diff --git a/src/config.rs b/src/config.rs index 59cc8b8..d8029c0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -13,7 +13,7 @@ pub const DEFAULT_FILENAME: &'static str = ".age.toml"; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Config { pub current_version: Version, - files: Vec, + pub files: Vec, } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -23,12 +23,6 @@ pub struct FileConfig { pub replace: String, } -impl Config { - pub fn get_files(&self) -> &Vec { - &self.files - } -} - pub fn resolve_config() -> Result { let pwd = current_dir().unwrap(); let config_path = pwd.join(Path::new(DEFAULT_FILENAME));