Skip to content

Commit

Permalink
review fixes 3 + fix add_new_line cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
weezy20 committed Mar 21, 2024
1 parent 354116e commit 99f4b64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/engines/pallet_engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ use toml_edit::DocumentMut;

/// The main entry point into the engine.
pub fn execute(pallet: AddPallet, runtime_path: PathBuf) -> anyhow::Result<()> {
let mut pe = PalletEngine::new(&runtime_path)?;
// Todo: Add option to source from cli
let dep = TomlEditor::infer(&runtime_path)?;
// Check if workspace has uncommitted changes, if yes, abort
if !is_git_repo_with_commits(&dep.workspace)? {
cliclack::log::error(format!("Workspace -> {}", dep.workspace.display()));
bail!("Workspace has uncommitted changes, aborting pallet addition");
}
let mut pe = PalletEngine::new(&runtime_path)?;
let steps = step_builder(pallet)?;
run_steps(pe, dep, steps)
}
Expand Down Expand Up @@ -419,7 +419,7 @@ impl PalletEngine {
let mut file = OpenOptions::new().append(true).open(&self.output)?;
let newlines: String = std::iter::repeat('\n').take(n).collect();
let rs = file.write_all(format!("{newlines}").as_bytes())?;
self.cursor += 1;
self.cursor += n;
Ok(rs)
}
/// Append raw tokens to `output` file, cursor should be handled by caller
Expand Down

0 comments on commit 99f4b64

Please sign in to comment.