Skip to content

Commit

Permalink
Fix writeme to handle new READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
meyertst-aws committed Jun 12, 2024
1 parent abe92e1 commit 55439f1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .tools/readmes/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,15 @@ def _transform_hello(self, pre_hello):
post_hello.append(action)
return sorted(post_hello, key=itemgetter("title_abbrev"))


def _transform_actions(self, pre_actions):
post_actions = []
for pre_id, pre in pre_actions.items():
try:
api = next(iter(pre["services"][self.scanner.svc_name]))
except:
raise MissingMetadataError(f"Action not found for example {pre_id} and service {self.scanner.svc_name}.")
raise MissingMetadataError(
f"Action not found for example {pre_id} and service {self.scanner.svc_name}."
)
action = {
"title_abbrev": api,
"file": self.scanner.snippet(
Expand Down Expand Up @@ -331,7 +332,8 @@ def write(self):
self.readme_filename,
f'{self.lang_config["service_folder"]}/{config.saved_readme}',
)
os.remove(self.readme_filename) # Do this so that new files are always updated to the correct case (README.md).
# Do this so that new files are always updated to the correct case (README.md).
Path(self.readme_filename).unlink(missing_ok=False)
with open(self.readme_filename, "w", encoding="utf-8") as f:
f.write(self.readme_text)
print(f"Updated {self.readme_filename}.")
Expand Down

0 comments on commit 55439f1

Please sign in to comment.