Skip to content

Commit

Permalink
feat: add date and time to generated alias file using chrono
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelarie committed Oct 17, 2024
1 parent f2dc127 commit a7826e2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
chrono = "0.4.38"
nu-cmd-lang = "0.98.0"
nu-command = "0.98.0"
nu-parser = "0.98.0"
Expand Down
9 changes: 7 additions & 2 deletions src/output/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ pub fn process_and_write_aliases(
File::create(&output_file_path).expect("Error creating output file");
let mut writer = BufWriter::new(file);

writeln!(writer, "# Aliases auto generated by nu-alias-converter\n")
.expect("Error writing to file");
// add date and time
writeln!(
writer,
"# Aliases auto generated by nu-alias-converter on {}",
chrono::Local::now().format("%Y-%m-%d %H:%M:%S")
)
.expect("Error writing to file");

let results: Vec<String> = aliases.par_iter().map(|alias| {
let command_ignores = &alias_ignore_result.command_ignores;
Expand Down

0 comments on commit a7826e2

Please sign in to comment.