Skip to content
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

chore(CLI): start working on CLI #4067

Conversation

pedrooot
Copy link
Member

Description

In this PR new CLI it's added, I'll be improving this but at the momment It just list services and shows the banner.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@pedrooot pedrooot requested review from a team as code owners May 23, 2024 08:21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an __init__.py file in this folder please.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

cli/cli.py Outdated
Comment on lines 23 to 27
total = 0
for value in track(range(100), description="Processing..."):
time.sleep(0.01)
total += 1
if show:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, it's to show the status bar

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: deleted

pyproject.toml Outdated
optional = true

[tool.poetry.group.cli.dependencies]
typer = "^0.12.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
typer = "^0.12.3"
typer = "0.12.3"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jfagoagas jfagoagas added the cli label May 23, 2024
Copy link

codecov bot commented May 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.35%. Comparing base (aa42507) to head (492e682).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4067      +/-   ##
==========================================
+ Coverage   86.26%   86.35%   +0.09%     
==========================================
  Files         790      790              
  Lines       24729    24728       -1     
==========================================
+ Hits        21333    21355      +22     
+ Misses       3396     3373      -23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

cli/cli.py Outdated
Comment on lines 17 to 42
@aws.command(
"list-services", help="List the AWS services that are supported by Prowler."
)
def list_services_aws():
print_services(list_services("aws"))


@azure.command(
"list-services", help="List the Azure services that are supported by Prowler."
)
def list_services_azure():
print_services(list_services("azure"))


@gcp.command(
"list-services", help="List the GCP services that are supported by Prowler."
)
def list_services_gcp():
print_services(list_services("gcp"))


@kubernetes.command(
"list-services", help="List the Kubernetes services that are supported by Prowler."
)
def list_services_kubernetes():
print_services(list_services("kubernetes"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to make this a generic command for all the providers in typer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

def create_list_commands(provider_typer: typer.Typer, provider_name: str):
@provider_typer.command(
"list-services",
help=f"List the {provider_name} services that are supported by Prowler.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you get the provider_name from typer.Typer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, done

Copy link
Member

@jfagoagas jfagoagas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔝

@pedrooot pedrooot merged commit e9670d7 into master May 24, 2024
11 checks passed
@pedrooot pedrooot deleted the PRWLR-3741-research-about-https-typer-tiangolo-com-and-set-a-base-project branch May 24, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants