pub struct Changelog {
pub maybe_unreleased: Option<ChangeSet>,
pub releases: Vec<Release>,
pub prologue: Option<String>,
pub epilogue: Option<String>,
}
Expand description
A log of changes for a specific project.
Fields§
§maybe_unreleased: Option<ChangeSet>
Unreleased changes don’t have version information associated with them.
releases: Vec<Release>
An ordered list of releases’ changes.
prologue: Option<String>
Any additional content that must appear at the beginning of the changelog.
epilogue: Option<String>
Any additional content that must appear at the end of the changelog
(e.g. historical changelog content prior to switching to unclog
).
Implementations§
source§impl Changelog
impl Changelog
sourcepub fn render_all(&self, config: &Config) -> String
pub fn render_all(&self, config: &Config) -> String
Renders the full changelog to a string.
sourcepub fn render_released(&self, config: &Config) -> String
pub fn render_released(&self, config: &Config) -> String
Renders all released versions’ entries, excluding unreleased ones.
sourcepub fn render_unreleased(&self, config: &Config) -> Result<String>
pub fn render_unreleased(&self, config: &Config) -> Result<String>
Renders just the unreleased changes to a string.
sourcepub fn init_dir<P: AsRef<Path>, R: AsRef<Path>, E: AsRef<Path>>(
config: &Config,
path: P,
maybe_prologue_path: Option<R>,
maybe_epilogue_path: Option<E>
) -> Result<()>
pub fn init_dir<P: AsRef<Path>, R: AsRef<Path>, E: AsRef<Path>>( config: &Config, path: P, maybe_prologue_path: Option<R>, maybe_epilogue_path: Option<E> ) -> Result<()>
Initialize a new (empty) changelog in the given path.
Creates the target folder if it doesn’t exist, and optionally copies an epilogue into it.
sourcepub fn generate_config<P, Q, S>(
config_path: P,
path: Q,
remote: S,
force: bool
) -> Result<()>where
P: AsRef<Path>,
Q: AsRef<Path>,
S: AsRef<str>,
pub fn generate_config<P, Q, S>( config_path: P, path: Q, remote: S, force: bool ) -> Result<()>where P: AsRef<Path>, Q: AsRef<Path>, S: AsRef<str>,
Attempts to generate a configuration file for the changelog in the given path, inferring as many parameters as possible from its environment.
sourcepub fn read_from_dir<P>(config: &Config, path: P) -> Result<Self>where
P: AsRef<Path>,
pub fn read_from_dir<P>(config: &Config, path: P) -> Result<Self>where P: AsRef<Path>,
Attempt to read a full changelog from the given directory.
sourcepub fn add_unreleased_entry<P, S, C, I, O>(
config: &Config,
path: P,
section: S,
maybe_component: Option<C>,
id: I,
content: O
) -> Result<()>where
P: AsRef<Path>,
S: AsRef<str>,
C: AsRef<str>,
I: AsRef<str>,
O: AsRef<str>,
pub fn add_unreleased_entry<P, S, C, I, O>( config: &Config, path: P, section: S, maybe_component: Option<C>, id: I, content: O ) -> Result<()>where P: AsRef<Path>, S: AsRef<str>, C: AsRef<str>, I: AsRef<str>, O: AsRef<str>,
Adds a changelog entry with the given ID to the specified section in
the unreleased
folder.
sourcepub fn add_unreleased_entry_from_template(
config: &Config,
path: &Path,
section: &str,
component: Option<String>,
id: &str,
platform_id: PlatformId,
message: &str
) -> Result<()>
pub fn add_unreleased_entry_from_template( config: &Config, path: &Path, section: &str, component: Option<String>, id: &str, platform_id: PlatformId, message: &str ) -> Result<()>
Attempts to add an unreleased changelog entry from the given parameters, rendering them through the change template specified in the configuration file.
The change template is assumed to be in Handlebars format.
sourcepub fn render_unreleased_entry_from_template(
config: &Config,
path: &Path,
section: &str,
component: Option<String>,
id: &str,
platform_id: PlatformId,
message: &str
) -> Result<String>
pub fn render_unreleased_entry_from_template( config: &Config, path: &Path, section: &str, component: Option<String>, id: &str, platform_id: PlatformId, message: &str ) -> Result<String>
Renders an unreleased changelog entry from the given parameters to a string, making use of the change template specified in the configuration file.
The change template is assumed to be in Handlebars format.