-
Notifications
You must be signed in to change notification settings - Fork 191
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
Command line: allow to not set input plugin for code #5140
Command line: allow to not set input plugin for code #5140
Conversation
for more information, see https://pre-commit.ci
Thanks @unkcpz . I agree that we should make this input optional, since it is a default value after all. But why don't we just make the option truly optional? In that case, a user simply does not provide a value for the |
It already a optional option since the default value of There are following chooses(but I think with their own downside) to do it without the extra flag I set it here:
Moreover, input_plugin option read a |
I think this is rather just a bug in the behavior. The option is required, so a |
Thanks!
I agree that it is a bad idea to complicate the interface. Thanks for tell me this is a bug, I thought it was designed to being like that, to prevent user from type ENTER without thinking too much etc. |
I am not sure yet why the prompt keeps prompting even if |
Hi @sphuber, I believe the mentioned repeat prompt behavior is by design. I find a test case to check this: aiida-core/tests/cmdline/params/options/test_interactive.py Lines 148 to 158 in b31e5f5
|
Good point. Looking into it more closely, I think the behavior is just the default prompting behavior of @click.command()
@click.option('--label', required=False, type=str, prompt='Label')
def cmd(label):
click.echo(f'Label: {label}') This will keep prompting for the value each time an empty value is specified, even though it is not required. I think this is a fundamental behavior of |
I have no strong opinion on this. For a new user who may not understand the exact meaning of each opinion, I sometimes want to type ENTER to see what will happened. I kindly understand why click keep on repeat prompt. If we want do it in the way you mentioned, it would be better to add a instruction next to The other problem is, for example if we set |
Codecov Report
@@ Coverage Diff @@
## develop #5140 +/- ##
===========================================
+ Coverage 80.71% 80.89% +0.18%
===========================================
Files 534 536 +2
Lines 36967 37069 +102
===========================================
+ Hits 29835 29983 +148
+ Misses 7132 7086 -46
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@sphuber Let's close this for now. I made tests for prompt behavior with rebase during the coding week but indeed still got the issue from |
For feature #4991.
An extra flag option
--bind-to-input-plugin
with default flag toTrue
is add toverdi code setup
to allow not to set the input plugin for the code.This may increase the configuration complex a bit of code setup. Especially when setting code through config file, if user do not want to bind input plugin to the code they need to set this flag to
false
explicitly like: