1778 raise EOFError |
1779 raise EOFError |
1779 line = line.rstrip(pycompat.oslinesep) |
1780 line = line.rstrip(pycompat.oslinesep) |
1780 |
1781 |
1781 return line |
1782 return line |
1782 |
1783 |
|
1784 if pycompat.TYPE_CHECKING: |
|
1785 |
|
1786 @overload |
|
1787 def prompt(self, msg: bytes, default: bytes) -> bytes: |
|
1788 pass |
|
1789 |
|
1790 @overload |
|
1791 def prompt(self, msg: bytes, default: None) -> Optional[bytes]: |
|
1792 pass |
|
1793 |
1783 def prompt(self, msg, default=b"y"): |
1794 def prompt(self, msg, default=b"y"): |
1784 """Prompt user with msg, read response. |
1795 """Prompt user with msg, read response. |
1785 If ui is not interactive, the default is returned. |
1796 If ui is not interactive, the default is returned. |
1786 """ |
1797 """ |
1787 return self._prompt(msg, default=default) |
1798 return self._prompt(msg, default=default) |
|
1799 |
|
1800 if pycompat.TYPE_CHECKING: |
|
1801 |
|
1802 @overload |
|
1803 def _prompt( |
|
1804 self, msg: bytes, default: bytes, **opts: _MsgOpts |
|
1805 ) -> bytes: |
|
1806 pass |
|
1807 |
|
1808 @overload |
|
1809 def _prompt( |
|
1810 self, msg: bytes, default: None, **opts: _MsgOpts |
|
1811 ) -> Optional[bytes]: |
|
1812 pass |
1788 |
1813 |
1789 def _prompt(self, msg, default=b'y', **opts): |
1814 def _prompt(self, msg, default=b'y', **opts): |
1790 opts = {**opts, 'default': default} |
1815 opts = {**opts, 'default': default} |
1791 if not self.interactive(): |
1816 if not self.interactive(): |
1792 self._writemsg(self._fmsgout, msg, b' ', type=b'prompt', **opts) |
1817 self._writemsg(self._fmsgout, msg, b' ', type=b'prompt', **opts) |