blob: b252318b03a9a5e00b4b23e3ab5b4d998ad370e7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShiftOS.Main.Terminal.Commands
{
public class Help : TerminalCommand
{
public override string Name { get; } = "help";
public override string Summary { get; } = "Shows the list of valid commands.";
public override string Usage { get; } = "help <command>";
public override bool Unlocked { get; set; } = true;
public override void Run(params string[] args)
{
if (args.Length > 0)
{
if (args[0] != null && args[0] != "")
{
bool solved = false;
foreach (var t in TerminalBackend.instances)
{
if (t.Name.ToLower() == args[0].ToLower())
{
solved = true;
WriteLine($"{t.Name}: {t.Summary} \n usage: {t.Usage}");
break;
}
if (t.Name.ToLower() == args[0].ToLower() && t.Unlocked == false) return;
}
if (!solved)
{
Write($"sbash: unexpected token: {args[0]}", Color.White);
}
}
}
else
{
WriteLine("List of valid commands for ShiftOS. \n To get help for a specific command, type \"help <command>\".\r\n");
foreach (var t in TerminalBackend.instances)
{
WriteLine($"{t.Name}: {t.Summary}");
}
}
}
}
}
|