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

Add -y option for bulk-add-officers to bypass user prompt #222

Open
AetherUnbound opened this issue Oct 22, 2022 · 3 comments
Open

Add -y option for bulk-add-officers to bypass user prompt #222

AetherUnbound opened this issue Oct 22, 2022 · 3 comments
Assignees
Labels
docker/env Docker, environment, or CI changes good first issue Good for newcomers hacktoberfest Good hacktoberfest issues help wanted Extra attention is needed

Comments

@AetherUnbound
Copy link
Collaborator

Similar to 221, it would be nice to be able to bypass the user prompt when performing the bulk upload that's part of just fresh-start. This is already possible if the end is set to "testing", but the CLI argument would be useful too:

if current_app.config["ENV"] == "testing" or prompt_yes_no(

@AetherUnbound AetherUnbound added docker/env Docker, environment, or CI changes good first issue Good for newcomers hacktoberfest Good hacktoberfest issues help wanted Extra attention is needed labels Oct 22, 2022
@sonali-rajput
Copy link

Can you please help me out how would I implement it as a cli?

@AetherUnbound
Copy link
Collaborator Author

AetherUnbound commented Oct 22, 2022

Hi @sonali-rajput, please go ahead! I'll assign it to you 😄
Edit: oops sorry I misread your comment, yes give me a little bit and I'll outline how this could be added 🙂

@AetherUnbound
Copy link
Collaborator Author

Okay thanks for your patience @sonali-rajput - what we'll need to do is add another option to the command here which is just a boolean flag for skipping the check prompt:

@click.command()
@click.argument("filename")
@click.option(
"--no-create", is_flag=True, help="only update officers; do not create new ones"
)
@click.option(
"--update-by-name",
is_flag=True,
help="update officers by first and last name (useful when star_no or unique_internal_identifier are not available)",
)
@click.option(
"--update-static-fields",
is_flag=True,
help="allow updating normally-static fields like race, birth year, etc.",
)

Then in the check step mentioned in the issue description, we also add another condition for seeing if that command line argument was passed in, and skip the prompt yes/no. This would look like:

if current_app.config["ENV"] == "testing" or bypass_prompt or prompt_yes_no(
    "Do you want to commit the above changes?"
):

You can also use the --update-static-fields as an example of a boolean flag parameter. Let me know if you have any more questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker/env Docker, environment, or CI changes good first issue Good for newcomers hacktoberfest Good hacktoberfest issues help wanted Extra attention is needed
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants