stillwwater / command_terminal

Unity Command Terminal: In-Game Console
MIT License
445 stars 60 forks source link

Command usage tip? #5

Closed ghost closed 6 years ago

ghost commented 6 years ago

Is there any workaround to add an suggestion how to use a command? lets say we have command "rate". how to output the tip like: "usage rate 25000" instead of the default error "'rate' requires exactly 1 argument? thanks.

stillwwater commented 6 years ago

Would printing a Hint message after the error message be useful?

[RegisterCommand(MinArgCount = 1, MaxArgCount = 1, Hint = "rate 25000")]
static void CommandRate(CommandArg[] args) { }

The error printed would then be:

Error: 'rate' requires exactly 1 argument
    Usage: rate 25000
ghost commented 6 years ago

Yes, it would be useful for sure. Since a user does not know the proper usage of the command. With the "Error: 'rate' requires exactly 1 argument" it is unclear what is the parameter has to be?

With a hint it would be understandable how to use the command. Thank you.

stillwwater commented 6 years ago

Added in 08a66da. Thanks for the suggestion!

ghost commented 6 years ago

Thank you for the implementation!