diff options
| author | Rapptz <[email protected]> | 2016-01-29 21:23:41 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-01-29 21:40:19 -0500 |
| commit | 7056a1f0ecd54162c39a99fb8565de869006463e (patch) | |
| tree | 8969d8318b637cf84a9ce651c5b5618f2c272b97 | |
| parent | [commands] Raise TypeError if the name is not a string. (diff) | |
| download | discord.py-7056a1f0ecd54162c39a99fb8565de869006463e.tar.xz discord.py-7056a1f0ecd54162c39a99fb8565de869006463e.zip | |
[commands] Change signature convention to use POSIX standards.
| -rw-r--r-- | discord/ext/commands/formatter.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/discord/ext/commands/formatter.py b/discord/ext/commands/formatter.py index b20be04f..4451a4ce 100644 --- a/discord/ext/commands/formatter.py +++ b/discord/ext/commands/formatter.py @@ -149,13 +149,18 @@ class HelpFormatter: params = cmd.clean_params if len(params) > 0: for name, param in params.items(): - cleaned_name = name.replace('_', '-') if param.default is not param.empty: - result.append('{0}={1}'.format(cleaned_name, param.default)) + # We don't want None or '' to trigger the [name=value] case and instead it should + # do [name] since [name=None] or [name=] are not exactly useful for the user. + should_print = param.default if isinstance(param.default, str) else param.default is not None + if should_print: + result.append('[{}={}]'.format(name, param.default)) + else: + result.append('[{}]'.format(name)) elif param.kind == param.VAR_POSITIONAL: - result.append(cleaned_name + '...') + result.append('[{}...]'.format(name)) else: - result.append(cleaned_name) + result.append('<{}>'.format(name)) return ' '.join(result) |