Skip to content

Commit

Permalink
fix: table generation
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed May 16, 2024
1 parent c90bee0 commit e821271
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

This repository maintains [bazel modules](https://bazel.build/external/module) for the various [cute_headers](https://github.com/RandyGaul/cute_headers).

<!-- BEGIN VERSIONS TABLE -->
| module | version | commit |
| ------ | ------- | ------ |
<!-- BEGIN VERSIONS TABLE -->
| cute_c2 | 1.10 | [7a6299dedddb5b076f3530315c2a3f3745e4760f](https://github.com/RandyGaul/cute_headers/blob/7a6299dedddb5b076f3530315c2a3f3745e4760f/cute_c2.h) |
| cute_math | 1.02 | [445d8cb94d5f662ab7932b36be4194780b33940e](https://github.com/RandyGaul/cute_headers/blob/445d8cb94d5f662ab7932b36be4194780b33940e/cute_math.h) |
<!-- END VERSIONS TABLE -->
Expand Down
7 changes: 6 additions & 1 deletion setup.nu
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ def update_versions_readme_table [] {
let begin_versions_table_str = '<!-- BEGIN VERSIONS TABLE -->';
let end_versions_table_str = '<!-- END VERSIONS TABLE -->';

let table_header = [
'| module | version | commit |',
'| ------ | ------- | ------ |',
];

let readme_contents_before = $readme_contents | split list $begin_versions_table_str | get 0 | append $begin_versions_table_str;
let readme_contents_after = $readme_contents | split list $end_versions_table_str | get 1 | prepend $end_versions_table_str;
let version_table_rows = $versions | columns | each {|col| module_readme_table_line $col ($versions | get $col) };

($readme_contents_before ++ $version_table_rows ++ $readme_contents_after) | save $readme_file_path -f --raw;
($readme_contents_before ++ $table_header ++ $version_table_rows ++ $readme_contents_after) | save $readme_file_path -f --raw;
}

$versions | columns | each {|col| setup_module $col ($versions | get $col) }
Expand Down

0 comments on commit e821271

Please sign in to comment.