|
4 | 4 | """ |
5 | 5 |
|
6 | 6 | import asyncio |
7 | | -import os, sys, io |
| 7 | +import os, sys, io, platform |
8 | 8 | import time, datetime |
9 | 9 | import getopt, json, shlex, re |
10 | 10 | import logging |
@@ -1036,7 +1036,10 @@ def _(event): |
1036 | 1036 | except asyncio.CancelledError: |
1037 | 1037 | # Handle task cancellation from KeyboardInterrupt in asyncio.run() |
1038 | 1038 | print("Exiting cli") |
1039 | | -interactive_loop.classic = False |
| 1039 | +if platform.system() == "Darwin" or platform.system() == "Windows": |
| 1040 | + interactive_loop.classic = True |
| 1041 | +else: |
| 1042 | + interactive_loop.classic = False |
1040 | 1043 |
|
1041 | 1044 | async def process_contact_chat_line(mc, contact, line): |
1042 | 1045 | if contact["type"] == 0: |
@@ -3130,6 +3133,7 @@ def usage () : |
3130 | 3133 | -D : debug |
3131 | 3134 | -S : scan for devices and show a selector |
3132 | 3135 | -l : list available ble/serial devices and exit |
| 3136 | + -C : toggles classic mode for prompt |
3133 | 3137 | -c <on/off> : disables most of color output if off |
3134 | 3138 | -T <timeout> : timeout for the ble scan (-S and -l) default 2s |
3135 | 3139 | -a <address> : specifies device address (can be a name) |
@@ -3198,12 +3202,14 @@ async def main(argv): |
3198 | 3202 | with open(MCCLI_ADDRESS, encoding="utf-8") as f : |
3199 | 3203 | address = f.readline().strip() |
3200 | 3204 |
|
3201 | | - opts, args = getopt.getopt(argv, "a:d:s:ht:p:b:fjDhvSlT:Pc:") |
| 3205 | + opts, args = getopt.getopt(argv, "a:d:s:ht:p:b:fjDhvSlT:Pc:C") |
3202 | 3206 | for opt, arg in opts : |
3203 | 3207 | match opt: |
3204 | 3208 | case "-c" : |
3205 | 3209 | if arg == "off": |
3206 | 3210 | process_event_message.color = False |
| 3211 | + case "-C": |
| 3212 | + interactive_loop.classic = not interactive_loop.classic |
3207 | 3213 | case "-d" : # name specified on cmdline |
3208 | 3214 | address = arg |
3209 | 3215 | case "-a" : # address specified on cmdline |
|
0 commit comments