1using System.Collections.Generic;
3using System.Threading.Tasks;
23 public string Name =>
"Help";
28 public string[]
Aliases =>
new string[] {
"Menu",
"?",
"#" };
37 public bool AppliesTo(
string CommandLine,
string[] Arguments, out
object Details)
40 return Arguments.Length <= 1;
53 StringBuilder Markdown =
new StringBuilder();
55 switch (Arguments.Length)
58 Markdown.AppendLine(
"The following commands are available through the chat interface.");
59 Markdown.AppendLine(
"To get help about a specific command, type `help COMMAND`, where `COMMAND` is the name of the command you want more help about.");
60 Markdown.AppendLine();
69 Markdown.Append(
", ");
72 Markdown.Append(Command);
76 Markdown.AppendLine(
".");
77 Markdown.AppendLine();
81 Markdown.AppendLine(
"Any other sentence will be executed on the command prompt, and the response returned.");
82 Markdown.AppendLine();
83 Markdown.AppendLine(
"Additional commands (apart from normal DOS commands) in command mode:");
84 Markdown.AppendLine();
85 Markdown.AppendLine(
"| Additional commands in command mode ||");
86 Markdown.AppendLine(
"|:-----------------------------------------|:----|");
87 Markdown.AppendLine(
"| `analyzeclock ...` | Executes `Waher.Utility.AnalyzeClock` with the provided parameters. |");
88 Markdown.AppendLine(
"| `csp ...` | Executes `Waher.Utility.Csp` with the provided parameters. |");
89 Markdown.AppendLine(
"| `exstat ...` | Executes `Waher.Utility.ExStat` with the provided parameters. |");
90 Markdown.AppendLine(
"| `extract ...` | Executes `Waher.Utility.Extract` with the provided parameters. |");
91 Markdown.AppendLine(
"| `install ...` | Executes `Waher.Utility.Install` with the provided parameters. |");
92 Markdown.AppendLine(
"| `regex ...` | Executes `Waher.Utility.RegEx` with the provided parameters. |");
93 Markdown.AppendLine(
"| `sign ...` | Executes `Waher.Utility.Sign` with the provided parameters. |");
94 Markdown.AppendLine(
"| `transform ...` | Executes `Waher.Utility.Transform` with the provided parameters. |");
97 Markdown.AppendLine(
"Any other sentence will be executed as [script](" +
Gateway.
GetUrl(
"/Script.md") +
"), and the response returned.");
101 if (
XmppServerModule.Instance.TryGetAdminCommand(Arguments[0].ToLower(), out LinkedList<IAdminCommand> Commands))
107 Markdown.Append(
'`');
108 Markdown.Append(
Help.Syntax);
109 Markdown.AppendLine(
"`");
110 Markdown.AppendLine();
112 foreach (
string Paragraph
in Help.Paragraphs)
114 Markdown.Append(
':');
115 Markdown.Append(
'\t');
116 Markdown.AppendLine(Paragraph);
117 Markdown.AppendLine();
123 Markdown.Append(
"Command not recognized. No help available.");
127 return ResponseCallback(Markdown.ToString(),
string.Empty);
138 new HelpItem(
"help",
"Gets help about available commands."),
139 new HelpItem(
"help COMMAND",
"Gets help about a specific command named `COMMAND`.")
Static class managing the runtime environment of the IoT Gateway.
static string GetUrl(string LocalResource)
Gets a URL for a resource.
bool CommandMode
Shell Command mode (true), or internal mode (false, default).
HelpItem[] GetHelp()
Gets help about the command.
Task Execute(ChatState State, string[] Arguments, string OrgMessage, object Details, ResponseCallbackHandler ResponseCallback)
Executes the command.
string[] Aliases
Optional set of aliases. Can be null.
bool AppliesTo(string CommandLine, string[] Arguments, out object Details)
If the command is applicable to the given command line.
Contains an item of information about a command.
Service Module hosting the XMPP broker and its components.
Basic interface for administration commands
delegate Task< string > ResponseCallbackHandler(string Markdown, string MessageId)
Delegate for response callback handler methods.