saltstack/salt — pull request #15273 by rallytime (2014-08-26 06:24:46+00:00)
Title: Add --list-profiles to salt-cloud query options

References #15063

Because we're using `optparse` instead of `argparse` in `salt/utils/parsers.py`, we can only choose to use an argument, or no arguments at all. Therefore, the feature request to have a default behavior to list all profiles and then add a provider name agrument to list only the provider's associated profiles isn't possible in `salt-cloud` until `parsers.py` is refactored.

From Python's `optparse` docs:
```
Typically, a given option either takes an argument or it doesn’t. Lots of people want an “optional option arguments” feature, meaning that some options will take an argument if they see it, and won’t if they don’t. This is somewhat controversial, because it makes parsing ambiguous: if -a takes an optional argument and -b is another option entirely, how do we interpret -ab? Because of this ambiguity, optparse does not support this feature.
```
I've opted for the "default" behavior, where passing --list-profiles will list ALL configured profiles. It's easy to change to only list profiles from a named provider, if that would be preferred.