Parse the line into a command name and a string containing the arguments. Returns a tuple containing (command, args, line, leading comment). 'command' and 'args' may be None if the line couldn't be parsed. 'line' in return tuple is the rewritten original line, with leading and trail
(self, line)
| 1782 | self._disable_readline() |
| 1783 | |
| 1784 | def parseline(self, line): |
| 1785 | """Parse the line into a command name and a string containing |
| 1786 | the arguments. Returns a tuple containing (command, args, line, leading comment). |
| 1787 | 'command' and 'args' may be None if the line couldn't be parsed. |
| 1788 | 'line' in return tuple is the rewritten original line, with leading |
| 1789 | and trailing space removed and special characters transformed into |
| 1790 | their aliases. If the line contains a leading comment, the leading |
| 1791 | comment will be removed in order to deduce a 'command' correctly. |
| 1792 | The 'command' is used to determine which 'do_<command>' function to invoke. |
| 1793 | The 'do_<command>' implementation can decide whether to retain or ignore the |
| 1794 | leading comment. |
| 1795 | |
| 1796 | Examples: |
| 1797 | |
| 1798 | > /*comment*/ help connect; |
| 1799 | line: help connect |
| 1800 | args: connect |
| 1801 | command: help |
| 1802 | leading comment: /*comment*/ |
| 1803 | |
| 1804 | > /*comment*/ ? connect; |
| 1805 | line: help connect |
| 1806 | args: connect |
| 1807 | command: help |
| 1808 | leading comment: /*comment*/ |
| 1809 | |
| 1810 | > /*first comment*/ select /*second comment*/ 1; |
| 1811 | line: select /*second comment*/ 1 |
| 1812 | args: /*second comment*/ 1 |
| 1813 | command: select |
| 1814 | leading comment: /*first comment*/ |
| 1815 | """ |
| 1816 | if ImpalaShell._has_leading_comment(line): |
| 1817 | leading_comment, line = ImpalaShell.strip_leading_comment(line.strip()) |
| 1818 | else: |
| 1819 | leading_comment, line = None, line.strip() |
| 1820 | |
| 1821 | if line and line[0] == '@': |
| 1822 | line = 'rerun ' + line[1:] |
| 1823 | return super(ImpalaShell, self).parseline(line) + (leading_comment,) |
| 1824 | |
| 1825 | @staticmethod |
| 1826 | def _has_leading_comment(raw_line): |
no test coverage detected