-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: initial CLI commit #127
base: dev
Are you sure you want to change the base?
Conversation
alexandreteles
commented
Nov 23, 2023
for more information, see https://pre-commit.ci
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #127 +/- ##
===========================================
- Coverage 84.35% 71.51% -12.84%
===========================================
Files 35 37 +2
Lines 818 1106 +288
===========================================
+ Hits 690 791 +101
- Misses 128 315 +187 ☔ View full report in Codecov by Sentry. |
Imagine being stopped by code coverage. It couldn't be me. Anyway, to use the CLI, you will need the following: The obviousInstall all dependencies. Use The not so obviousExport a GitHub token to your env: Then just ./cli.py Everything else should be exploratory. The CLI uses the docstrings to generate help, so rewriting is trivial if something isn't clear. I will write instrumentation around it so it can be used from actions, but the design decision about how that can be achieved adequately from calling repositories needs more consideration. I think the @ReVanced/infrastructure team also lacks people with experience in writing Github actions, so @PalmDevs, I might need your help with this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Are internal types such as JSONResponse or "dictionary" to be documented in places such as the command spec instead of saying "A json string" or "key value pair"?
- I have not reviewed all CLI command descriptions but many were incomplete/incorrect and need to be looked into
- Instead of having a release and releases command you should only provide "releases" with additional arguments to specify the tag (including the alias tag "latest") and a list of releases
- What is the purpose of the options "get_file_path", "get_filitered_repositories" or "scaffold"?
- May be out of scope but, the routes contributors and team could be merged with an argument to only retrieve the contributors that are present in the org (aka the team)
|
||
class CLI(object): | ||
""" | ||
CLI for the ReVanced API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLI for the ReVanced API. | |
CLI for ReVanced API. |
) | ||
) | ||
|
||
def get_filtered_repositories(self) -> list[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing comment
setattr(self, attr.cli_name or attr_name, attr) | ||
self.__imported_methods.append(attr.cli_name or attr_name) | ||
|
||
def helper(self, name=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing comment
@cli.helper(name="manager") | ||
async def cli_root(bootstrap=None, custom_source=None, dev=False) -> dict[str, dict]: | ||
""" | ||
Returns a dictionary containing a list of the main ReVanced tools. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description is incorrect
@cli.helper(name="tools") | ||
async def cli_tools() -> dict[str, dict]: | ||
""" | ||
Retrieve a list of releases for a GitHub repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect description
@cli.helper(name="contributors") | ||
async def cli_contributors() -> dict[str, dict]: | ||
""" | ||
Retrieve a list of releases for a GitHub repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect description
repository: str, per_page: int = 100, page: int = 1 | ||
) -> dict[str, dict]: | ||
""" | ||
Retrieve a list of releases for a GitHub repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect description
@@ -161,6 +301,42 @@ async def get_contributors(request: Request, repo: str) -> JSONResponse: | |||
return json(data, status=200) | |||
|
|||
|
|||
@cli.helper(name="project-contributors") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify to "contributors"
@@ -218,3 +440,31 @@ async def get_team_members(request: Request) -> JSONResponse: | |||
} | |||
|
|||
return json(data, status=200) | |||
|
|||
|
|||
@cli.helper(name="team-members") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify to "team"
return json(await generate_contributors_data(), status=200) | ||
|
||
|
||
@cli.helper(name="tools") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be out of scope for this PR but with the routes manager and patches this route is obsolete