|
|
|
@ -372,12 +372,45 @@ public final function Option(BaseText longName, optional BaseText shortName) {
|
|
|
|
|
|
|
|
|
|
/// Adds description to the selected sub-command / option. |
|
|
|
|
/// |
|
|
|
|
/// Highlights parts of the description in-between "`" characters. |
|
|
|
|
/// |
|
|
|
|
/// Does nothing if nothing is yet selected. |
|
|
|
|
public final function Describe(BaseText description) { |
|
|
|
|
_.memory.Free(selectedDescription); |
|
|
|
|
if (description != none) { |
|
|
|
|
selectedDescription = description.Copy(); |
|
|
|
|
local int fromIndex, toIndex; |
|
|
|
|
local BaseText.Formatting keyWordFormatting; |
|
|
|
|
local bool lookingForEnd; |
|
|
|
|
local MutableText coloredDescription; |
|
|
|
|
|
|
|
|
|
if (description == none) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
keyWordFormatting = _.text.FormattingFromColor(_.color.TextEmphasis); |
|
|
|
|
coloredDescription = description.MutableCopy(); |
|
|
|
|
while (true) { |
|
|
|
|
if (lookingForEnd) { |
|
|
|
|
toIndex = coloredDescription.IndexOf(P("`"), fromIndex + 1); |
|
|
|
|
} else { |
|
|
|
|
fromIndex = coloredDescription.IndexOf(P("`"), toIndex + 1); |
|
|
|
|
} |
|
|
|
|
if (toIndex < 0 || fromIndex < 0) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (lookingForEnd) { |
|
|
|
|
coloredDescription.ChangeFormatting( |
|
|
|
|
keyWordFormatting, |
|
|
|
|
fromIndex, |
|
|
|
|
toIndex - fromIndex + 1); |
|
|
|
|
lookingForEnd = false; |
|
|
|
|
} else { |
|
|
|
|
lookingForEnd = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
coloredDescription.Replace(P("`"), P("")); |
|
|
|
|
if (lookingForEnd) { |
|
|
|
|
coloredDescription.ChangeFormatting(keyWordFormatting, fromIndex); |
|
|
|
|
} |
|
|
|
|
_.memory.Free(selectedDescription); |
|
|
|
|
selectedDescription = coloredDescription.IntoText(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Sets new name of the command that caller [`CommandDataBuilder`] constructs. |
|
|
|
|