diff --git a/shtab/__init__.py b/shtab/__init__.py
index 4543999..a0125ec 100644
--- a/shtab/__init__.py
+++ b/shtab/__init__.py
@@ -204,8 +204,7 @@ def get_bash_commands(root_parser, root_prefix, choice_functions=None):
                             ),
                             file=fd,
                         )
-                    else:
-                        assert isinstance(sub.choices, dict)
+                    elif isinstance(sub.choices, dict):
                         log.debug("subcommand:%s", cmd)
                         if sub.choices[cmd].add_help:
                             commands.append(cmd)
@@ -215,6 +214,8 @@ def get_bash_commands(root_parser, root_prefix, choice_functions=None):
                             )
                         else:
                             log.debug("skip:subcommand:%s", cmd)
+                    else:
+                        commands.append(cmd)
             else:
                 log.debug("uncompletable:{}:{}".format(prefix, sub.dest))
 

AssertionError from assert isinstance(sub.choices, dict)
Hello,
here is a valid example parser:

```python
#!/usr/bin/env python
import argparse

def parser():
        p = argparse.ArgumentParser()
        p.add_argument("arg1", choices=("foo", "bar"))
        return p


if __name__ == "__main__":
        p = parser()
        args = p.parse_args()
        print(args)
```

shtab fails because it expected another choices type (btw lists instead of tuple don't work neither).

I got it working with the following fix:

```diff
diff --git a/shtab/__init__.py b/shtab/__init__.py
index 4543999..d9d5117 100644
--- a/shtab/__init__.py
+++ b/shtab/__init__.py
@@ -13,7 +13,7 @@ from argparse import (
     _VersionAction,
 )
 from functools import total_ordering
-
+from collections.abc import Sequence, MappingView
 
 def get_version_dist(name=__name__):
     from pkg_resources import DistributionNotFound, get_distribution
@@ -204,8 +204,10 @@ def get_bash_commands(root_parser, root_prefix, choice_functions=None):
                             ),
                             file=fd,
                         )
+                    elif isinstance(sub.choices, (MappingView, Sequence)):
+                        commands.append(cmd)
                     else:
-                        assert isinstance(sub.choices, dict)
+                        assert isinstance(sub.choices, dict), f"expected choices dict, got {cmd} from {sub.choices!r}"
                         log.debug("subcommand:%s", cmd)
                         if sub.choices[cmd].add_help:
                             commands.append(cmd)
```

Is this the correct solution to the problem?
diff --git a/tests/test_shtab.py b/tests/test_shtab.py
index 464b73e..bd9c938 100644
--- a/tests/test_shtab.py
+++ b/tests/test_shtab.py
@@ -6,6 +6,7 @@ Currently runnable via nosetests, e.g.:
 """
 import logging
 import subprocess
+from argparse import ArgumentParser
 
 import pytest
 
@@ -69,6 +70,14 @@ def test_choices():
     assert "" not in shtab.Required.FILE
 
 
+@pytest.mark.parametrize("shell", SUPPORTED_SHELLS)
+def test_main(shell, caplog):
+    with caplog.at_level(logging.INFO):
+        main(["-s", shell, "shtab.main.get_main_parser"])
+
+    assert not caplog.record_tuples
+
+
 @pytest.mark.parametrize("shell", SUPPORTED_SHELLS)
 def test_complete(shell, caplog):
     parser = get_main_parser()
@@ -84,8 +93,17 @@ def test_complete(shell, caplog):
 
 
 @pytest.mark.parametrize("shell", SUPPORTED_SHELLS)
-def test_main(shell, caplog):
+def test_positional_choices(shell, caplog):
+    parser = ArgumentParser(prog="test")
+    parser.add_argument("posA", choices=["one", "two"])
     with caplog.at_level(logging.INFO):
-        main(["-s", shell, "shtab.main.get_main_parser"])
+        completion = shtab.complete(parser, shell=shell)
+    print(completion)
+
+    if shell == "bash":
+        shell = Bash(completion)
+        # ideally should check completion
+        # https://github.com/iterative/shtab/issues/11
+        shell.compgen('-W "$_shtab_test_options_"', "", "-h --help")
 
     assert not caplog.record_tuples

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.9
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
cfgv==3.4.0
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
filelock==3.18.0
identify==2.6.9
iniconfig==2.1.0
nodeenv==1.9.1
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
pytest==8.3.5
pytest-cov==6.0.0
PyYAML==6.0.2
-e git+https://github.com/iterative/shtab.git@2a4b0387a0bca2049adc3221c3f97d05942a0411#egg=shtab
tomli==2.2.1
virtualenv==20.29.3

name: shtab
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:
      - cfgv==3.4.0
      - coverage==7.8.0
      - distlib==0.3.9
      - exceptiongroup==1.2.2
      - filelock==3.18.0
      - identify==2.6.9
      - iniconfig==2.1.0
      - nodeenv==1.9.1
      - packaging==24.2
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - pre-commit==4.2.0
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pyyaml==6.0.2
      - tomli==2.2.1
      - virtualenv==20.29.3
prefix: /opt/conda/envs/shtab

tests/test_shtab.py::test_positional_choices[bash]
tests/test_shtab.py::test_bash[export tests/test_shtab.py::test_bash[--z tests/test_shtab.py::test_bash_compgen tests/test_shtab.py::test_choices tests/test_shtab.py::test_main[bash] tests/test_shtab.py::test_main[zsh] tests/test_shtab.py::test_complete[bash] tests/test_shtab.py::test_complete[zsh] tests/test_shtab.py::test_positional_choices[zsh]
shtab/__init__.py
shtab/__init__.py