From 683c40e3cf27524c8c2ef797331dd2d8db5283c3 Mon Sep 17 00:00:00 2001 From: Andrew Brandt Date: Thu, 1 May 2025 09:05:03 -0700 Subject: [PATCH 1/2] chore: update the order of CLI args and documentation Signed-off-by: Andrew Brandt --- current-implemented-CLI.md | 29 ++++++++----- src/version2config.py | 88 ++++++++++++++++++++------------------ 2 files changed, 64 insertions(+), 53 deletions(-) diff --git a/current-implemented-CLI.md b/current-implemented-CLI.md index 5efd36b..b46f914 100644 --- a/current-implemented-CLI.md +++ b/current-implemented-CLI.md @@ -2,18 +2,25 @@ ## Currently Implemented -- `include-team` - Include a team to the query - `output-file` - Define the filename and location of the output file +- `temp-dir` - The temporary directory to write JSON response files + +- `include-team` - Include a team to the query + ## To Be Implemented -- `include_user` - Include a specific user to the query -- `include_repository` - Include specific repo(s) to the query -- `include_organization_repository` - Include specific org(s) repo(s) to the query -- `include_label` - Include a specific label to the query -- `exclude_organization` - Exclude specific org(s) from the output -- `exclude_repository` - Exclude specific repo(s) from the output -- `exclude_organization_repository` - Exclude specific org(s) repo(s) from the output -- `exclude_user` - Exclude specific user from the output -- `exclude_label` - Exclude issues with specific label from the output -- `publish_board` - Copy output of script to a common board in GitHub by using the GH API +- `include-user` - Include a specific user to the query +- `include-repository` - Include specific repo to the query +- `include-organization` - Include specific org to a query +- `include-organization-repository` - Include specific org/repo to the query +- `include-label` - Include a specific label to the query + +- `exclude-team` - Exclude specific team from the output +- `exclude-user` - Exclude specific user from the output +- `exclude-repository` - Exclude specific repo from the output +- `exclude-organization` - Exclude specific org from the output +- `exclude-organization-repository` - Exclude specific org/repo from the output +- `exclude-label` - Exclude issues with specific label from the output + +- `publish-board` - Copy output of script to a common board in GitHub by using the GH API diff --git a/src/version2config.py b/src/version2config.py index 972e675..dee2180 100644 --- a/src/version2config.py +++ b/src/version2config.py @@ -16,8 +16,7 @@ def __init__(self): def init_parser(self): parser = argparse.ArgumentParser( prog='VersionTwo', - description="Render an HTML page from a collection of GitHub Issues and Pull Requests" - ) + description="Render an HTML page from a collection of GitHub Issues and Pull Requests",) parser.add_argument( "--output-file", @@ -25,8 +24,7 @@ def init_parser(self): action="store", type=str, default="output.projects.json", - help="The output file to write the json data to" - ) + help="The output file to write the json data to",) parser.add_argument( "--temp-dir", @@ -34,8 +32,14 @@ def init_parser(self): action="store", type=str, default="tmp.dir", - help="The temporary directory to store the json data files", - ) + help="The temporary directory to store the json data files",) + + parser.add_argument( + "--include-team", + dest="include_team", + action="append", + type=str, + help="Include provided teams in the output",) parser.add_argument( "--include-user", @@ -45,22 +49,6 @@ def init_parser(self): nargs="+", help="Include all issues and PRs for the provided user [Required Parameter]",) - parser.add_argument( - "--include-team", - dest="include_team", - action="append", - type=str, - help="Include provided teams in the output" - ) - - parser.add_argument( - "--exclude-team", - dest="exclude_team", - action="append", - type=str, - help="Exclude provided teams in the output" - ) - parser.add_argument( "--include-repository", dest="include_repository", @@ -68,6 +56,13 @@ def init_parser(self): type=str, help="Include all issues and PRs from the specified repository",) + parser.add_argument( + "--include-organization", + dest="include_organization", + action="append", + type=str, + help="Include all issues and PRs from the specified organization",) + parser.add_argument( "--include-organization-repository", dest="include_organization_repository", @@ -83,11 +78,18 @@ def init_parser(self): help="Include all issues and PRs with the specified label",) parser.add_argument( - "--exclude-organization", - dest="exclude_organization", + "--exclude-team", + dest="exclude_team", action="append", type=str, - help="Exclude all issues and PRs from the specified organization",) + help="Exclude provided teams in the output",) + + parser.add_argument( + "--exclude-user", + dest="exclude_user", + action="append", + type=str, + help="Exclude all issues and PRs for the provided user",) parser.add_argument( "--exclude-repository", @@ -97,19 +99,19 @@ def init_parser(self): help="Exclude all issues and PRs from the specified repository",) parser.add_argument( - "--exclude-organization-repository", - dest="exclude_organization_repository", + "--exclude-organization", + dest="exclude_organization", action="append", type=str, - help="Exclude all issues and PRs from the specified " - "organization/repository",) + help="Exclude all issues and PRs from the specified organization",) parser.add_argument( - "--exclude-user", - dest="exclude_user", + "--exclude-organization-repository", + dest="exclude_organization_repository", action="append", type=str, - help="Exclude all issues and PRs for the provided user",) + help="Exclude all issues and PRs from the specified " + "organization/repository",) parser.add_argument( "--exclude-label", @@ -126,20 +128,21 @@ def init_parser(self): parsed_args = parser.parse_args() - self.include_user = parsed_args.include_user + self.output_file = parsed_args.output_file + self.temp_dir = parsed_args.temp_dir self.include_team = parsed_args.include_team + self.include_user = parsed_args.include_user self.include_repository = parsed_args.include_repository + self.include_organization = parsed_args.include_organization self.include_organization_repository = parsed_args.include_organization_repository self.include_label = parsed_args.include_label - self.exclude_organization = parsed_args.exclude_organization + self.exclude_team = parsed_args.exclude_team + self.exclude_user = parsed_args.exclude_user self.exclude_repository = parsed_args.exclude_repository + self.exclude_organization = parsed_args.exclude_organization self.exclude_organization_repository = parsed_args.exclude_organization_repository - self.exclude_user = parsed_args.exclude_user self.exclude_label = parsed_args.exclude_label - self.exclude_team = parsed_args.exclude_team self.publish_board = parsed_args.publish_board - self.output_file = parsed_args.output_file - self.temp_dir = parsed_args.temp_dir def init_logger(self): logging.basicConfig(level=self.LOG_LEVEL, format=self.LOG_FORMAT) @@ -151,15 +154,16 @@ def display_config(self): logging.info("Configuration:") logging.info(f"Output File: {self.output_file}") logging.info(f"Temporary Directory: {self.temp_dir}") + logging.info(f"Include Team: {self.include_team}") logging.info(f"Include User: {self.include_user}") logging.info(f"Include Repository: {self.include_repository}") + logging.info(f"Include Organization: {self.include_organization}") logging.info(f"Include Organization/Repository: {self.include_organization_repository}") logging.info(f"Include Label: {self.include_label}") - logging.info(f"Include Team: {self.include_team}") - logging.info(f"Exclude Organization: {self.exclude_organization}") + logging.info(f"Exclude Team: {self.exclude_team}") + logging.info(f"Exclude User: {self.exclude_user}") logging.info(f"Exclude Repository: {self.exclude_repository}") + logging.info(f"Exclude Organization: {self.exclude_organization}") logging.info(f"Exclude Organization/Repository: {self.exclude_organization_repository}") - logging.info(f"Exclude User: {self.exclude_user}") logging.info(f"Exclude Label: {self.exclude_label}") - logging.info(f"Exclude Team: {self.exclude_team}") logging.info(f"Publish Board: {self.publish_board}") From 07330ddd4eb94c5835945792e4c09347d37786d1 Mon Sep 17 00:00:00 2001 From: Andrew Brandt Date: Thu, 1 May 2025 09:12:48 -0700 Subject: [PATCH 2/2] remove trailing commas and move close parans down Signed-off-by: Andrew Brandt --- src/version2config.py | 48 ++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/src/version2config.py b/src/version2config.py index dee2180..051aec0 100644 --- a/src/version2config.py +++ b/src/version2config.py @@ -16,7 +16,8 @@ def __init__(self): def init_parser(self): parser = argparse.ArgumentParser( prog='VersionTwo', - description="Render an HTML page from a collection of GitHub Issues and Pull Requests",) + description="Render an HTML page from a collection of GitHub Issues and Pull Requests" + ) parser.add_argument( "--output-file", @@ -24,7 +25,8 @@ def init_parser(self): action="store", type=str, default="output.projects.json", - help="The output file to write the json data to",) + help="The output file to write the json data to" + ) parser.add_argument( "--temp-dir", @@ -32,14 +34,16 @@ def init_parser(self): action="store", type=str, default="tmp.dir", - help="The temporary directory to store the json data files",) + help="The temporary directory to store the json data files" + ) parser.add_argument( "--include-team", dest="include_team", action="append", type=str, - help="Include provided teams in the output",) + help="Include provided teams in the output" + ) parser.add_argument( "--include-user", @@ -47,63 +51,72 @@ def init_parser(self): action="append", type=str, nargs="+", - help="Include all issues and PRs for the provided user [Required Parameter]",) + help="Include all issues and PRs for the provided user [Required Parameter]" + ) parser.add_argument( "--include-repository", dest="include_repository", action="append", type=str, - help="Include all issues and PRs from the specified repository",) + help="Include all issues and PRs from the specified repository" + ) parser.add_argument( "--include-organization", dest="include_organization", action="append", type=str, - help="Include all issues and PRs from the specified organization",) + help="Include all issues and PRs from the specified organization" + ) parser.add_argument( "--include-organization-repository", dest="include_organization_repository", action="append", type=str, - help="Include all issues and PRs from the specified organization/repository",) + help="Include all issues and PRs from the specified organization/repository" + ) parser.add_argument( "--include-label", dest="include_label", action="append", type=str, - help="Include all issues and PRs with the specified label",) + help="Include all issues and PRs with the specified label" + ) parser.add_argument( "--exclude-team", dest="exclude_team", action="append", type=str, - help="Exclude provided teams in the output",) + help="Exclude provided teams in the output" + ) parser.add_argument( "--exclude-user", dest="exclude_user", action="append", type=str, - help="Exclude all issues and PRs for the provided user",) + help="Exclude all issues and PRs for the provided user" + ) parser.add_argument( "--exclude-repository", dest="exclude_repository", action="append", type=str, - help="Exclude all issues and PRs from the specified repository",) + help="Exclude all issues and PRs from the specified repository" + ) parser.add_argument( "--exclude-organization", dest="exclude_organization", action="append", type=str, - help="Exclude all issues and PRs from the specified organization",) + help="Exclude all issues and PRs from the specified organization" + ) parser.add_argument( "--exclude-organization-repository", @@ -111,20 +124,23 @@ def init_parser(self): action="append", type=str, help="Exclude all issues and PRs from the specified " - "organization/repository",) + "organization/repository" + ) parser.add_argument( "--exclude-label", dest="exclude_label", action="append", type=str, - help="Exclude all issues and PRs with the specified label",) + help="Exclude all issues and PRs with the specified label" + ) parser.add_argument( "--publish-board", dest="publish_board", action="store_const", - help="The organization/board to publish (add) the collection of GitHub Issues and Pull Requests",) + help="The organization/board to publish (add) the collection of GitHub Issues and Pull Requests" + ) parsed_args = parser.parse_args()