Writes a value to the Sublime Text console, formatting it for output via text.format() and then encoding unicode to utf-8 :param string: The value to write :param params: Params to interpolate into the string using the % operator :param strip: If a sin
(string, params=None, strip=True, indent=None, prefix=True)
| 4 | |
| 5 | |
| 6 | def console_write(string, params=None, strip=True, indent=None, prefix=True): |
| 7 | """ |
| 8 | Writes a value to the Sublime Text console, formatting it for output via |
| 9 | text.format() and then encoding unicode to utf-8 |
| 10 | |
| 11 | :param string: |
| 12 | The value to write |
| 13 | |
| 14 | :param params: |
| 15 | Params to interpolate into the string using the % operator |
| 16 | |
| 17 | :param strip: |
| 18 | If a single trailing newline should be stripped |
| 19 | |
| 20 | :param indent: |
| 21 | If all lines should be indented by a set indent after being de-dented |
| 22 | |
| 23 | :param prefix: |
| 24 | If the string "Package Control: " should be prefixed to the string |
| 25 | """ |
| 26 | |
| 27 | string = text.format(str(string), params, strip=strip, indent=indent) |
| 28 | |
| 29 | if prefix: |
| 30 | sys.stdout.write('Package Control: ') |
| 31 | |
| 32 | print(string) |
no test coverage detected