Update Usage messages to conform to new Usage message contributor guidelines (#3180)

This commit is contained in:
pajlada 2021-08-21 14:41:06 +02:00 committed by GitHub
parent ad4a0c28d1
commit fe8aa33980
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 10 deletions

View file

@ -215,3 +215,28 @@ Keep the element on the stack if possible. If you need a pointer or have complex
- Use the [object tree](https://doc.qt.io/qt-5/objecttrees.html#) to manage lifetimes where possible. Objects are destroyed when their parent object is destroyed.
- If you have to explicitly delete an object use `variable->deleteLater()` instead of `delete variable`. This ensures that it will be deleted on the correct thread.
- If an object doesn't have a parent, consider using `std::unique_ptr<Type, DeleteLater>` with `DeleteLater` from "src/common/Common.hpp". This will call `deleteLater()` on the pointer once it goes out of scope, or the object is destroyed.
## Conventions
#### Usage strings
When informing the user about how a command is supposed to be used, we aim to follow [this standard](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html) where possible.
- Square brackets are reserved for `[optional arguments]`.
- Angle brackets are reserved for `<required arguments>`.
- The word _Usage_ should be capitalized and must be followed by a colon.
- If the usage deserves a description, put a dot after all parameters and explain it briefly.
##### Good
- `Usage: /block <user>`
- `Usage: /unblock <user>. Unblocks a user.`
- `Usage: /streamlink <channel>`
- `Usage: /usercard <user> [channel]`
##### Bad
- `Usage /streamlink <channel>` - Missing colon after _Usage_.
- `usage: /streamlink <channel>` - _Usage_ must be capitalized.
- `Usage: /streamlink channel` - The required argument `channel` must be wrapped in angle brackets.
- `Usage: /streamlink <channel>.` - Don't put a dot after usage if it's not followed by a description.

View file

@ -296,7 +296,7 @@ void CommandController::initialize(Settings &, Paths &paths)
auto blockLambda = [](const auto &words, auto channel) {
if (words.size() < 2)
{
channel->addMessage(makeSystemMessage("Usage: /block [user]"));
channel->addMessage(makeSystemMessage("Usage: /block <user>"));
return "";
}
@ -341,7 +341,7 @@ void CommandController::initialize(Settings &, Paths &paths)
auto unblockLambda = [](const auto &words, auto channel) {
if (words.size() < 2)
{
channel->addMessage(makeSystemMessage("Usage: /unblock [user]"));
channel->addMessage(makeSystemMessage("Usage: /unblock <user>"));
return "";
}
@ -455,7 +455,7 @@ void CommandController::initialize(Settings &, Paths &paths)
if (words.size() < 2)
{
channel->addMessage(
makeSystemMessage("Usage /user [user] (channel)"));
makeSystemMessage("Usage: /user <user> [channel]"));
return "";
}
QString userName = words[1];
@ -625,7 +625,7 @@ void CommandController::initialize(Settings &, Paths &paths)
(!channel->isTwitchChannel() || channel->isEmpty()))
{
channel->addMessage(makeSystemMessage(
"Usage: /streamlink [channel]. You can also use the "
"Usage: /streamlink <channel>. You can also use the "
"command without arguments in any Twitch channel to open "
"it in streamlink."));
return "";
@ -646,7 +646,7 @@ void CommandController::initialize(Settings &, Paths &paths)
(!channel->isTwitchChannel() || channel->isEmpty()))
{
channel->addMessage(makeSystemMessage(
"Usage: /popout [channel]. You can also use the command "
"Usage: /popout <channel>. You can also use the command "
"without arguments in any Twitch channel to open its "
"popout chat."));
return "";
@ -673,7 +673,7 @@ void CommandController::initialize(Settings &, Paths &paths)
if (words.size() < 2)
{
channel->addMessage(
makeSystemMessage("Usage: /settitle <stream title>."));
makeSystemMessage("Usage: /settitle <stream title>"));
return "";
}
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
@ -704,7 +704,7 @@ void CommandController::initialize(Settings &, Paths &paths)
if (words.size() < 2)
{
channel->addMessage(
makeSystemMessage("Usage: /setgame <stream game>."));
makeSystemMessage("Usage: /setgame <stream game>"));
return "";
}
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
@ -769,7 +769,7 @@ void CommandController::initialize(Settings &, Paths &paths)
const ChannelPtr channel) {
if (words.size() < 2)
{
channel->addMessage(makeSystemMessage("Usage: /openurl <URL>."));
channel->addMessage(makeSystemMessage("Usage: /openurl <URL>"));
return "";
}

View file

@ -810,8 +810,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
if (tags == "bad_delete_message_error" || tags == "usage_delete")
{
channel->addMessage(makeSystemMessage(
"Usage: \"/delete <msg-id>\" - can't take more "
"than one argument"));
"Usage: /delete <msg-id>. Can't take more than one argument"));
}
else if (tags == "host_on" || tags == "host_target_went_offline")
{