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

Reading Username and Password from environment to enable scripting #40

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

steilerDev
Copy link

Gives the option to specify APPLE_ID_USER and APPLE_ID_PWD in the environment, to run this script non-interactively.

Fails if MFA is required non-interactively.

This is my first time touching D-lang - please let me know if this is not how it should be done :D

@steilerDev steilerDev mentioned this pull request Apr 22, 2024
if (!interactive) {
string appleId = environment.get("APPLE_ID_USER");
string password = environment.get("APPLE_ID_PWD");
if(interactive && (appleId is null || password is null)) {
Copy link
Owner

Choose a reason for hiding this comment

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

I would probably do an interactive || here, as if the interactive switch is given it's probably to make the prompt appear.

Copy link
Author

Choose a reason for hiding this comment

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

I think && is the better choice, as we want the prompt only in interactive mode - if there is no interactive mode, don't prompt, but fail - otherwise you'd receive a prompt in an non-interactive session.

For my use case I want to use this in an autonomous scripting scenario - failing in case input is required is exactly what I want :D

Copy link
Owner

Choose a reason for hiding this comment

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

Maybe just interactive then?

frontends/cli/source/cli_frontend.d Show resolved Hide resolved
@Dadoum
Copy link
Owner

Dadoum commented Apr 23, 2024

Otherwise your code is well-made

@Dadoum Dadoum force-pushed the main branch 2 times, most recently from c544aab to 77d51fc Compare May 17, 2024 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants