'Every single command ends with 'zsh: command not found: amplify_env'

I have some kind of a problem here. Every time I type down a command in my terminal, it ends up with "zsh: command not found: amplify_env". Whatever the command is.

I can type something like "test" in my terminal, it will end up with that exact same message.

It looks like my terminal is trying to execute an amplify_env command every time i do something in my terminal. Has anyone an idea from where this can come?

Thank you!



Solution 1:[1]

In zsh rc add this function :

# .zshrc

amplify_env () {
    PROJECT_DIR=$(git rev-parse --show-toplevel 2>/dev/null) 

    ENV=$PROJECT_DIR/amplify/.config/local-env-info.json 

    if [ -f "$ENV" ]; then
        env_info=$(cat $ENV | jq -r ".envName") 
        echo "(? $env_info)"
    fi
}

https://dev.to/siegerts/displaying-the-active-amplify-environment-alongside-the-current-git-branch-4hmg

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Benoit