1784 """Prompt user with msg, read response. |
1784 """Prompt user with msg, read response. |
1785 If ui is not interactive, the default is returned. |
1785 If ui is not interactive, the default is returned. |
1786 """ |
1786 """ |
1787 return self._prompt(msg, default=default) |
1787 return self._prompt(msg, default=default) |
1788 |
1788 |
1789 def _prompt(self, msg, **opts): |
1789 def _prompt(self, msg, default=b'y', **opts): |
1790 default = opts['default'] |
1790 opts = {**opts, 'default': default} |
1791 if not self.interactive(): |
1791 if not self.interactive(): |
1792 self._writemsg(self._fmsgout, msg, b' ', type=b'prompt', **opts) |
1792 self._writemsg(self._fmsgout, msg, b' ', type=b'prompt', **opts) |
1793 self._writemsg( |
1793 self._writemsg( |
1794 self._fmsgout, default or b'', b"\n", type=b'promptecho' |
1794 self._fmsgout, default or b'', b"\n", type=b'promptecho' |
1795 ) |
1795 ) |