khard
khard copied to clipboard
Stop asking for confirmation when non-interactive `modify`
Would it be possible to get rid of the confirmation question when
stdin is used as input for modify
? When used in a program, it is
impossible to pass both the yaml content and the answer to the
question through stdin.
$ khard modify --uid 8a < /tmp/damien.yaml
[…]
Do you want to proceed (y/n)?
Expected: no question because I already use stdin to pass the contact, I can't use it to also answer the question.
If I understand the code in khard/khard.py line 1790-1803 correctly we reopen the terminal device to read the answer from the user after reading the input. Does it not work for you?
Does it not work for you?
I don't know how to do that, not even if it is possible.
For me it works.
~% khard ls -a dropin
Address book: dropin
Index Name Phone E-Mail UID
1 von Bar, Foo t
~% khard modify -a dropin --uid=t < foo
Modification
Name: Foo hans von Bar
Address book: dropin
Miscellaneous
UID: t9bo8ud06exx18qnar01kdkhhvb1mcrel7tl
Do you want to proceed (y/n)? y
Done
~% khard ls -a dropin
Address book: dropin
Index Name Phone E-Mail UID
1 von Bar, Foo hans t
After reading the file from stdin the terminal device is opened again and connected to stdin.
Non the less your feature request is interesting and can be discussed.
Sorry, I wasn't clear enough. I don't know how to confirm using stdin when calling khard from a program.
I think you can open a pull request with a new option --assume-yes
or --no-confirm
or so. Many package managers have that.