Skip to content

feat: implementation for CLI #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 1, 2025
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# EditorConfig is awesome: https://editorconfig.org

# top-most EditorConfig file
root = true

[*]
max_line_length=120
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
*/**/*.iml

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc

.idea

**/**.DS_Store
_site/*
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
versiontwo-venv
versiontwo-venv-312
10 changes: 10 additions & 0 deletions src/version_two.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from version_two_config import VersionTwoConfig


def main():
config = VersionTwoConfig()
config.display_config()


if __name__ == "__main__":
main()
116 changes: 116 additions & 0 deletions src/version_two_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import argparse


class VersionTwoConfig:
def __init__(self):
parser = argparse.ArgumentParser(
prog='VersionTwo',
description="Render an HTML page from a collection of GitHub Issues and Pull Requests, "
"NOTE: `--include-user GITHUB_USER_ID` is a required parameter",
)

parser.add_argument(
"--include-user",
dest="include_user",
action="append",
type=str,
nargs="+",
help="Include all issues and PRs for the provided user [Required Parameter]",
required=True,)

parser.add_argument(
"--include-repository",
dest="include_repository",
action="append",
type=str,
nargs="+",
help="Include all issues and PRs from the specified repository",)

parser.add_argument(
"--include-organization-repository",
dest="include_organization_repository",
action="append",
type=str,
nargs="+",
help="Include all issues and PRs from the specified organization/repository",)

parser.add_argument(
"--include-label",
dest="include_label",
action="append",
type=str,
nargs="+",
help="Include all issues and PRs with the specified label",)

parser.add_argument(
"--exclude-organization",
dest="exclude_organization",
action="append",
type=str,
nargs="+",
help="Exclude all issues and PRs from the specified organization",)

parser.add_argument(
"--exclude-repository",
dest="exclude_repository",
action="append",
type=str,
nargs="+",
help="Exclude all issues and PRs from the specified repository",)

parser.add_argument(
"--exclude-organization-repository",
dest="exclude_organization_repository",
action="append",
type=str,
nargs="+",
help="Exclude all issues and PRs from the specified "
"organization/repository",)

parser.add_argument(
"--exclude-user",
dest="exclude_user",
action="append",
type=str,
nargs="+",
help="Exclude all issues and PRs for the provided user",)

parser.add_argument(
"--exclude-label",
dest="exclude_label",
action="append",
type=str,
nargs="+",
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",)

parsed_args = parser.parse_args()

self.include_user = parsed_args.include_user
self.include_repository = parsed_args.include_repository
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_repository = parsed_args.exclude_repository
self.exclude_organization_repository = parsed_args.exclude_organization_repository
self.exclude_user = parsed_args.exclude_user
self.exclude_label = parsed_args.exclude_label
self.publish_board = parsed_args.publish_board

def display_config(self):
print("Configuration:")
print(f"Include Repository: {self.include_repository}")
print(f"Include Organization/Repository: {self.include_organization_repository}")
print(f"Include User: {self.include_user}")
print(f"Include Label: {self.include_label}")
print(f"Exclude Organization: {self.exclude_organization}")
print(f"Exclude Repository: {self.exclude_repository}")
print(f"Exclude Organization/Repository: {self.exclude_organization_repository}")
print(f"Exclude User: {self.exclude_user}")
print(f"Exclude Label: {self.exclude_label}")
print(f"Publish Board: {self.publish_board}")