How to use a tab to create a list of possible entries in my folder?

I use iTerm on my mac and ZSH and about my zsh with the theme dstufft

I wrote this in my .bash_rc

 function goToPythonApp {
        # no params given
        if [ -z "$1" ]; then
            cd ~/Documents/Apps/PythonApps
        else
            cd ~/Documents/Apps/PythonApps/$1
        fi
   }

so i can print goToPythonApp abc

Then i will switch to ~/Documents/Apps/PythonApps/abc

But sometimes I forget the name of the folder in ~/Documents/Apps/PythonApps/

Is there an input method goToPythonApp, then click <space>, then click <tab>to generate a list of entries in ~/Documents/Apps/PythonApps/?

Similar to how ZSH (or oh-my-zsh) can autocomplete for half-printed commands?

Either this, or I can type goToPythonApp ab, then press <tab>, and automatically complete the sentence abc, which is a valid entry in the folder ~/Documents/Apps/PythonApps/?

UPDATE

The method used suggested in the answer below I received command not found for complete.

autoload bashcompinit && bashcompinit, .bash_rc file

command not found for complete , .

+6
2

Zsh . .zshrc :

setopt autocd
pyapps=~/Documents/Apps/PythonApps

autocd , , , cd.

( man zshexpn FILENAME GENERATION) ~ -prefixed . pyapps , ~pyapps , .

,

  • ~pyapps cd "$pyapps"
  • ~pyapps/Project1 cd "$pyapps/Project1"
  • ~pyapps/<TAB> $pyapps.
+3

bash

script rc bash_profile,

function goToPythonApp {
        # no params given
        if [ -z "$1" ]; then
            cd ~/Documents/Apps/PythonApps/
        else
            cd ~/Documents/Apps/PythonApps/$1
        fi
}

function _GPA {
    local cur
    cur=${COMP_WORDS[COMP_CWORD]}
    COMPREPLY=( $( compgen -S/ -d ~/Documents/Apps/PythonApps/$cur | cut -b 18- ) )
}


complete -o nospace -F _GPA goToPythonApp

,

+2