sm_autocomplete() { # make zsh emulate bash if necessary if [[ -n "$ZSH_VERSION" ]]; then autoload bashcompinit bashcompinit fi snakemake_options=$(snakemake --snakefile Snakefile --list) complete -W "${snakemake_options}" 'snakemake' } cd() { builtin cd "$@" if [ -f "Snakefile" ]; then sm_autocomplete fi }