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

♻️ Refactor CLI print functions #575

Closed
1 task done
keithrfung opened this issue Apr 6, 2022 · 2 comments
Closed
1 task done

♻️ Refactor CLI print functions #575

keithrfung opened this issue Apr 6, 2022 · 2 comments
Assignees
Labels
duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers hacktoberfest Issues for the Hacktoberfest help wanted Extra attention is needed

Comments

@keithrfung
Copy link
Collaborator

Is there an existing issue for this?

  • I have searched the existing issues

Suggestion

The CLI includes some printing function that are currently in a base step but could be isolated completely to a set of printer functions.

https://github.com/microsoft/electionguard-python/blob/8aa589c9744bdf52e1e2659e2f83c255ffc65441/src/electionguard_cli/e2e_steps/e2e_step_base.py#L5

https://github.com/microsoft/electionguard-python/blob/main/src/electionguard_cli/e2e_steps/print_results_step.py

Possible Implementation

A simpler implementation that is a bit more pythonic is shifting to make a printer module for the CLI. This could include some standard color coding for different sections. That could be changed.

header_color = "green"
description_color = "white"

def print_header(header:str) -> None:
    ...

The base step can be removed and instead methods can just be imported directly as they are used. The name printer_tools is just an example.

from electionguard_cli.printer_tools import print_header

Anything else?

No response

@keithrfung keithrfung added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed hacktoberfest Issues for the Hacktoberfest labels Apr 6, 2022
@phershbe
Copy link
Contributor

phershbe commented May 5, 2022

@keithrfung I'm digging into the code and the issues in order to contribute more. I think I'm understanding this. The file that you have referenced above is from a branch, and the file is now here: https://github.com/microsoft/electionguard-python/blob/main/src/electionguard_cli/cli_steps/cli_step_base.py and color coding has been added but a printer module has not been added yet, correct?

@keithrfung keithrfung added the duplicate This issue or pull request already exists label Jun 28, 2022
@keithrfung
Copy link
Collaborator Author

Duplicate of #601

@keithrfung keithrfung marked this as a duplicate of #601 Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers hacktoberfest Issues for the Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants