From 2aa8b0dc9534dacfc1d67c61d8b963a9661aea3b Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Mon, 29 Jan 2018 11:27:17 +0100 Subject: [PATCH] kete/prompt: make completion case insensitive because there is a high chance users will not use uppercase for the device addresses --- tools/tuhi-kete.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/tuhi-kete.py b/tools/tuhi-kete.py index dfa561b..e3c8757 100755 --- a/tools/tuhi-kete.py +++ b/tools/tuhi-kete.py @@ -639,11 +639,11 @@ class TuhiKeteShell(cmd.Cmd): completion = [] if len(fields) == 2: for device in self._manager.devices: - if device.address.startswith(text): + if device.address.startswith(text.upper()): completion.append(device.address) elif len(fields) == 3: for v in ('on', 'off'): - if v.startswith(text): + if v.startswith(text.lower()): completion.append(v) return completion @@ -707,7 +707,7 @@ class TuhiKeteShell(cmd.Cmd): completion = [] if len(fields) == 2: for device in self._manager.devices: - if device.address.startswith(text): + if device.address.startswith(text.upper()): completion.append(device.address) elif len(fields) == 3: @@ -726,7 +726,7 @@ class TuhiKeteShell(cmd.Cmd): logger.error(f'{device} / {timestamps}') for t in timestamps: - if t.startswith(text): + if t.startswith(text.lower()): completion.append(t) return completion @@ -779,7 +779,7 @@ class TuhiKeteShell(cmd.Cmd): completion = [] if len(fields) == 2: for v in ('on', 'off'): - if v.startswith(text): + if v.startswith(text.lower()): completion.append(v) return completion @@ -821,7 +821,7 @@ class TuhiKeteShell(cmd.Cmd): completion = [] if len(fields) == 2: 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) return completion