python click argument boolean or variable

Solution for python click argument boolean or variable
is Given Below:

Is it possible to create a custom class for python Click that can either be a boolean or take argument and make it variable.

e.g. being able to do either
adding –param OR –param=foo

Similar to https://stackoverflow.com/a/45870325/2844674 but that assumes you don’t specify –param at all and then it prompts you.