❯ ptpython --print-completion zsh | sed 's/compdef ptpython/compdef -P pt(i|)python[0-9.]#/' | xsel -ib
#compdef -P pt(i|)python[0-9.]#
# AUTOMATCALLY GENERATED by `shtab`
_shtab_ptpython_commands() {
local _commands=(
)
_describe 'ptpython commands' _commands
}
_shtab_ptpython_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"(- : *)--print-completion[print shell completion script]:print_completion:(bash zsh tcsh)"
"--vi[Enable Vi key bindings]"
{-i,--interactive}"[Start interactive shell after executing this file.]"
"--light-bg[Run on a light background (use dark colors for text).]"
"--dark-bg[Run on a dark background (use light colors for text).]"
"--config-file[Location of configuration file.]:config_file:_files -g *.py"
"--history-file[Location of history file.]:history_file:_files"
"(- : *)"{-V,--version}"[show program\'s version number and exit]"
"(-)*:Script and arguments:_script_args"
)
_shtab_ptpython() {
local context state line curcontext="$curcontext"
local one_or_more='(-)*'
local reminder='(*)'
if ((${_shtab_you_get_options[(I)${(q)one_or_more}*]} + ${_shtab_you_get_options[(I)${(q)reminder}*]} == 0)); then # noqa: E501
_shtab_ptpython_options+=(': :_shtab_ptpython_commands' '*::: :->ptpython')
fi
_arguments -C $_shtab_ptpython_options
case $state in
ptpython)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:_shtab_ptpython-$line[1]:"
case $line[1] in
esac
esac
}
# Custom Preamble
_script_args() {
_arguments -S -s '(-)1:script_args:_files -g *.py' '*: :_files'
}
# End Custom Preamble
typeset -A opt_args
_shtab_ptpython "$@"
Same as https://github.com/inducer/pudb/pull/546. And fix #508