usage property
The usage is usually a single line that briefly outlines the command's syntax.
Implementation
@override
NatrixLine get usage {
NatrixText usage = NatrixText("Usage: ", style: .bold);
NatrixCommand command = context.cmd;
final List<String> cmds = [command.id];
while (command.hasParent()) {
command = command.parent!;
cmds.add(command.id);
}
String out = "";
out += cmds.reversed.join(" ");
if (context.cmd.children.isNotEmpty && context.cmd.children.length < 4) {
out += " <${context.cmd.children.map((e) => e.id).join("|")}>";
}
if (context.cmd.argumentTip.isNotEmpty) {
out += " <${context.cmd.argumentTip}>";
}
return NatrixText.join([usage, NatrixText(out)]).asLineSection();
}