Skip to content

Commit 626a018

Browse files
committed
classic mode by default on macs and windows, -C toggles the mode
1 parent 2474231 commit 626a018

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/meshcore_cli/meshcore_cli.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55

66
import asyncio
7-
import os, sys, io
7+
import os, sys, io, platform
88
import time, datetime
99
import getopt, json, shlex, re
1010
import logging
@@ -1036,7 +1036,10 @@ def _(event):
10361036
except asyncio.CancelledError:
10371037
# Handle task cancellation from KeyboardInterrupt in asyncio.run()
10381038
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
10401043

10411044
async def process_contact_chat_line(mc, contact, line):
10421045
if contact["type"] == 0:
@@ -3130,6 +3133,7 @@ def usage () :
31303133
-D : debug
31313134
-S : scan for devices and show a selector
31323135
-l : list available ble/serial devices and exit
3136+
-C : toggles classic mode for prompt
31333137
-c <on/off> : disables most of color output if off
31343138
-T <timeout> : timeout for the ble scan (-S and -l) default 2s
31353139
-a <address> : specifies device address (can be a name)
@@ -3198,12 +3202,14 @@ async def main(argv):
31983202
with open(MCCLI_ADDRESS, encoding="utf-8") as f :
31993203
address = f.readline().strip()
32003204

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")
32023206
for opt, arg in opts :
32033207
match opt:
32043208
case "-c" :
32053209
if arg == "off":
32063210
process_event_message.color = False
3211+
case "-C":
3212+
interactive_loop.classic = not interactive_loop.classic
32073213
case "-d" : # name specified on cmdline
32083214
address = arg
32093215
case "-a" : # address specified on cmdline

0 commit comments

Comments
 (0)