Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sphinx Completion Bug #41

Closed
psacawa opened this issue Jul 18, 2021 · 1 comment · Fixed by #44
Closed

Sphinx Completion Bug #41

psacawa opened this issue Jul 18, 2021 · 1 comment · Fixed by #44
Assignees
Labels
p0-critical Max priority (ASAP) shell-zsh

Comments

@psacawa
Copy link

psacawa commented Jul 18, 2021

Thanks for making this. It should be built right into argparse, but people were apprehensive. I will try to send PRs to other projects to refactor so external shtab invocation is possible.

I got an exception while doing external completion generation on sphinx:

shtab -s zsh -u sphinx.cmd.build.get_parser

  File "/home/psacawa/.pyenv/versions/3.9.0/bin/shtab", line 8, in <module>
    sys.exit(main())
  File "/home/psacawa/.pyenv/versions/3.9.0/lib/python3.9/site-packages/shtab/main.py", line 61, in main
    complete(
  File "/home/psacawa/.pyenv/versions/3.9.0/lib/python3.9/site-packages/shtab/__init__.py", line 570, in complete
    return completer(
  File "/home/psacawa/.pyenv/versions/3.9.0/lib/python3.9/site-packages/shtab/__init__.py", line 522, in complete_zsh
    root_options="\n  ".join(
  File "/home/psacawa/.pyenv/versions/3.9.0/lib/python3.9/site-packages/shtab/__init__.py", line 523, in <genexpr>
    format_optional(opt)
  File "/home/psacawa/.pyenv/versions/3.9.0/lib/python3.9/site-packages/shtab/__init__.py", line 399, in format_optional
    help=escape_zsh(opt.help or ""),
  File "/home/psacawa/.pyenv/versions/3.9.0/lib/python3.9/site-packages/shtab/__init__.py", line 361, in escape_zsh
    return RE_ZSH_SPECIAL_CHARS.sub(r"\\\1", string)
TypeError: expected string or bytes-like object

It doesn't occur for bash:

shtab -u sphinx.cmd.build.get_parser

@casperdcl casperdcl self-assigned this Jul 20, 2021
@casperdcl casperdcl added p0-critical Max priority (ASAP) shell-zsh labels Jul 20, 2021
casperdcl added a commit that referenced this issue Jul 20, 2021
@casperdcl
Copy link
Collaborator

casperdcl commented Jul 20, 2021

Hmmm... due to use of sphinx.locale._TranslationProxy instead of str.

This bizarre stuff: https://github.com/sphinx-doc/sphinx/blob/f9941b9402821de2d60c1e94f9ac5cf0379640d0/sphinx/cmd/build.py#L27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p0-critical Max priority (ASAP) shell-zsh
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants