Skip to content

shtab generates invalid shell output from Python files that have an explicit py extension #20

@mpkocher

Description

@mpkocher

Using shtab 1.3.0, the autocomplete output generated from python files with an explicit .py extension and/or with a '-' in the file name will create invalid code.

For example, using zsh and my_example.py will generate invalid code.

The code generated looks like this.

_shtab_my_example.py_options_=(
  "(- :)"{-h,--help}"[show this help message and exit]"
  "--input-file[Path to file]:input_file:"
  "--max-records[Max Records to process]:max_records:"
  "--alpha[Level of alpha filtering to apply]:alpha:"
  "--print-completion[print shell completion script]:print_completion:(bash zsh)"
)

Using my-example.py will generate similar issues.

Specifically, the error look similar to this:

./my_example2.py --hel...        
_my_example2.py:5: unknown file attribute: \n
_my_example2.py:5: unknown file attribute: \n
_my_example2.py:5: unknown file attribute: \n

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions