diff --git a/tldr.py b/tldr.py
index bccf57b..7ca0233 100755
--- a/tldr.py
+++ b/tldr.py
@@ -15,7 +15,6 @@ from urllib.error import HTTPError, URLError
 from termcolor import colored
 import colorama  # Required for Windows
 import argcomplete
-from glob import glob
 
 __version__ = "1.0.0"
 __client_specification__ = "1.3"
@@ -223,17 +222,18 @@ LEADING_SPACES_NUM = 2
 
 COMMAND_SPLIT_REGEX = re.compile(r'(?P<param>{{.+?}})')
 PARAM_REGEX = re.compile(r'(?:{{)(?P<param>.+?)(?:}})')
-CACHE_FILE_REGEX = re.compile(r'.*\/(.*)\.md')
 
 
 def get_commands(platforms=None):
     if platforms is None:
         platforms = get_platform_list()
 
-    cache_files = []
-    for platform in platforms:
-        cache_files += glob(os.path.join(get_cache_dir(), 'pages', platform, '*.md'))
-    return [re.search(CACHE_FILE_REGEX, x).group(1) for x in cache_files]
+    commands = []
+    if os.path.exists(get_cache_dir()):
+        for platform in platforms:
+            path = os.path.join(get_cache_dir(), 'pages', platform)
+            commands += [file[:-3] for file in os.listdir(path) if file.endswith(".md")]
+    return commands
 
 
 def colors_of(key):
@@ -269,7 +269,7 @@ def output(page):
                     colored(
                         line.replace('>', '').replace('<', ''),
                         *colors_of('description')
-                    )
+                )
                 sys.stdout.buffer.write(line.encode('utf-8'))
             elif line[0] == '-':
                 line = '\n' + ' ' * LEADING_SPACES_NUM + \
@@ -381,9 +381,8 @@ def main():
                         help='Override the default language')
 
     parser.add_argument(
-        'command', type=str, nargs='*', help="command to lookup", metavar='command',
-        choices=get_commands() + [[]]
-    )
+        'command', type=str, nargs='*', help="command to lookup", metavar='command'
+    ).completer = argcomplete.completers.ChoicesCompleter(get_commands() + [[]])
 
     argcomplete.autocomplete(parser)
     options = parser.parse_args()

"Documentation is not available" never shows up
Whenever an invalid command is entered `tldr: error: argument command: invalid choice: 'noexist' (choose from` and then all the commands available is printed instead of the `Consider contributing a Pull Request.....`

Bug is caused by https://github.com/tldr-pages/tldr-python-client/commit/d273fcd1c91d6aa6a8d4535d92feffecb2c02364, specifically the `choices=get_commands() + [[]]`
diff --git a/tests/test_tldr.py b/tests/test_tldr.py
index 53279b1..82061ac 100644
--- a/tests/test_tldr.py
+++ b/tests/test_tldr.py
@@ -2,7 +2,9 @@ import sys
 import io
 import types
 import unittest
+import unittest.mock
 import tldr
+import pytest
 
 
 class TLDRTests(unittest.TestCase):
@@ -12,7 +14,7 @@ class TLDRTests(unittest.TestCase):
                 old_stdout = sys.stdout
                 sys.stdout = io.StringIO()
                 sys.stdout.buffer = types.SimpleNamespace()
-                sys.stdout.buffer.write = lambda x: sys.stdout.write(x.decode('utf-8'))
+                sys.stdout.buffer.write = lambda x: sys.stdout.write(x.decode("utf-8"))
                 tldr.output(f_original)
 
                 sys.stdout.seek(0)
@@ -21,3 +23,12 @@ class TLDRTests(unittest.TestCase):
 
                 correct_output = f_rendered.read()
                 self.assertEqual(tldr_output, correct_output)
+
+    def test_error_message(self):
+        with unittest.mock.patch("sys.argv", ["tldr", "73eb6f19cd6f"]):
+            with pytest.raises(SystemExit) as pytest_wrapped_e:
+                tldr.main()
+            correct_output = "`73eb6f19cd6f` documentation is not available. Consider contributing Pull Request to https://github.com/tldr-pages/tldr"  # noqa
+            print("Test {}".format(pytest_wrapped_e))
+            assert pytest_wrapped_e.type == SystemExit
+            assert str(pytest_wrapped_e.value) == correct_output

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-runner
apt-get update apt-get install -y gcc
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
argcomplete==3.6.1
colorama==0.4.6
exceptiongroup==1.2.2
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-runner==6.0.1
termcolor==2.5.0
-e git+https://github.com/tldr-pages/tldr-python-client.git@09dd82e8f8635313e49a6bcd7131341a1ac2c94c#egg=tldr
tomli==2.2.1

name: tldr-python-client
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - argcomplete==3.6.1
      - colorama==0.4.6
      - exceptiongroup==1.2.2
      - iniconfig==2.1.0
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-runner==6.0.1
      - termcolor==2.5.0
      - tomli==2.2.1
prefix: /opt/conda/envs/tldr-python-client

tests/test_tldr.py::TLDRTests::test_error_message
tests/test_tldr.py::TLDRTests::test_whole_page
tldr.py
tldr.py