mirror of https://github.com/tuhiproject/tuhi.git
kete/prompt: make completion case insensitive
because there is a high chance users will not use uppercase for the device addressespull/41/head
parent
e7a38c3bdc
commit
2aa8b0dc95
|
@ -639,11 +639,11 @@ class TuhiKeteShell(cmd.Cmd):
|
||||||
completion = []
|
completion = []
|
||||||
if len(fields) == 2:
|
if len(fields) == 2:
|
||||||
for device in self._manager.devices:
|
for device in self._manager.devices:
|
||||||
if device.address.startswith(text):
|
if device.address.startswith(text.upper()):
|
||||||
completion.append(device.address)
|
completion.append(device.address)
|
||||||
elif len(fields) == 3:
|
elif len(fields) == 3:
|
||||||
for v in ('on', 'off'):
|
for v in ('on', 'off'):
|
||||||
if v.startswith(text):
|
if v.startswith(text.lower()):
|
||||||
completion.append(v)
|
completion.append(v)
|
||||||
return completion
|
return completion
|
||||||
|
|
||||||
|
@ -707,7 +707,7 @@ class TuhiKeteShell(cmd.Cmd):
|
||||||
completion = []
|
completion = []
|
||||||
if len(fields) == 2:
|
if len(fields) == 2:
|
||||||
for device in self._manager.devices:
|
for device in self._manager.devices:
|
||||||
if device.address.startswith(text):
|
if device.address.startswith(text.upper()):
|
||||||
completion.append(device.address)
|
completion.append(device.address)
|
||||||
|
|
||||||
elif len(fields) == 3:
|
elif len(fields) == 3:
|
||||||
|
@ -726,7 +726,7 @@ class TuhiKeteShell(cmd.Cmd):
|
||||||
logger.error(f'{device} / {timestamps}')
|
logger.error(f'{device} / {timestamps}')
|
||||||
|
|
||||||
for t in timestamps:
|
for t in timestamps:
|
||||||
if t.startswith(text):
|
if t.startswith(text.lower()):
|
||||||
completion.append(t)
|
completion.append(t)
|
||||||
|
|
||||||
return completion
|
return completion
|
||||||
|
@ -779,7 +779,7 @@ class TuhiKeteShell(cmd.Cmd):
|
||||||
completion = []
|
completion = []
|
||||||
if len(fields) == 2:
|
if len(fields) == 2:
|
||||||
for v in ('on', 'off'):
|
for v in ('on', 'off'):
|
||||||
if v.startswith(text):
|
if v.startswith(text.lower()):
|
||||||
completion.append(v)
|
completion.append(v)
|
||||||
|
|
||||||
return completion
|
return completion
|
||||||
|
@ -821,7 +821,7 @@ class TuhiKeteShell(cmd.Cmd):
|
||||||
completion = []
|
completion = []
|
||||||
if len(fields) == 2:
|
if len(fields) == 2:
|
||||||
for device in self._manager.pairable_devices + self._manager.devices:
|
for device in self._manager.pairable_devices + self._manager.devices:
|
||||||
if device.address.startswith(text):
|
if device.address.startswith(text.upper()):
|
||||||
completion.append(device.address)
|
completion.append(device.address)
|
||||||
|
|
||||||
return completion
|
return completion
|
||||||
|
|
Loading…
Reference in New Issue