From 35a5ef5532ada87289b988c4e10ceb43afe3bd02 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 25 Jun 2022 17:16:05 +0200 Subject: cws-status: Align extension name and version in two columns Rather than output a single tab to separate the extension name and version, use `ljust` to create two visual columns. --- README.md | 4 ++-- cws-status | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1cbc1d6..17e7089 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ authenticating with the cookies from the Google Chrome browser. --url 'https://chrome.google.com/webstore/devconsole/' \ --cookie-path '~/Library/Application Support/Google/Chrome/Profile 1/Cookies' \ Example - Example extension BETA (Version 1.0) Published to testers - Example extension (Version 1.0) Published - public + Example extension BETA (Version 1.0) Published to testers + Example extension (Version 1.0) Published - public ## Install diff --git a/cws-status b/cws-status index 89df639..0a1c033 100644 --- a/cws-status +++ b/cws-status @@ -97,6 +97,17 @@ item_statuses = tree.xpath('//table[//th[text()="Item"]]/tbody/tr/td[7]/text()') # Print the publish status for the queried extensions. +matched_extensions = [] + for i, name in enumerate(item_names_versions): if re.search(regex, name): - print(f'{name}\t{item_statuses[i]}') + matched_extensions.append((name, item_statuses[i])) + +name_width = max([len(pair[0]) for pair in matched_extensions]) +column_padding = 7 + +for name, version in matched_extensions: + print( + name.ljust(name_width + column_padding), + version, + ) -- cgit v1.2.3