Skip to content

Commit

Permalink
runner: make generate() public
Browse files Browse the repository at this point in the history
  • Loading branch information
erikgrinaker committed May 5, 2024
1 parent 7f8aede commit f911c66
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Backwards-incompatible changes:

Improvements:

* Add `generate()` to generate output for a goldenscript input.
* Add `Argument.parse()` to parse values into e.g. integers or booleans.
* Add `Command.line_number` with the command's position in the script.
* Add `Runner` error context such as the command or hook name and line number.
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,4 @@ mod parser;
mod runner;

pub use command::{Argument, Command};
pub use runner::{run, Runner};
pub use runner::{generate, run, Runner};
2 changes: 1 addition & 1 deletion src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub fn run<R: Runner, P: AsRef<std::path::Path>>(runner: &mut R, path: P) -> std
}

/// Generates output for a goldenscript input, without comparing them.
pub(crate) fn generate<R: Runner>(runner: &mut R, input: &str) -> std::io::Result<String> {
pub fn generate<R: Runner>(runner: &mut R, input: &str) -> std::io::Result<String> {
let mut output = String::with_capacity(input.len()); // common case: output == input

// Detect end-of-line format.
Expand Down

0 comments on commit f911c66

Please sign in to comment.