From 8ec044f8c9cab43ac10c86ce605264e351f3e237 Mon Sep 17 00:00:00 2001 From: AShifter Date: Tue, 21 Nov 2017 15:12:50 -0700 Subject: Improved help and added SFTP let's see if this works --- ShiftOS.Main/Terminal/Commands/Help.cs | 31 +++++++++++++++++++++++++++---- ShiftOS.Main/Terminal/Commands/sftp.cs | 21 +++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 ShiftOS.Main/Terminal/Commands/sftp.cs (limited to 'ShiftOS.Main/Terminal/Commands') diff --git a/ShiftOS.Main/Terminal/Commands/Help.cs b/ShiftOS.Main/Terminal/Commands/Help.cs index 9a9e415..248623e 100644 --- a/ShiftOS.Main/Terminal/Commands/Help.cs +++ b/ShiftOS.Main/Terminal/Commands/Help.cs @@ -10,15 +10,38 @@ namespace ShiftOS.Main.Terminal.Commands { public override string Name { get; } = "help"; public override string Summary { get; } = "Shows the list of valid commands."; - public override string Usage { get; } = "n/a"; + public override string Usage { get; } = "help "; public override bool Unlocked { get; set; } = false; public override void Run(params string[] args) { - WriteLine("List of valid commands for ShiftOS.\r\n"); - foreach (var t in TerminalBackend.instances) + if (args.Length > 0) { - WriteLine($"{t.Name}: {t.Summary}"); + if (args[0] != null && args[0] != "") + { + bool solved = false; + foreach (var t in TerminalBackend.instances) + { + if (t.Name == args[0]) + { + solved = true; + WriteLine($"{t.Name}: {t.Summary} \nusage: {t.Usage}"); + break; + } + } + if (!solved) + { + WriteLine("The command \"" + args[0] + "\" could not be found."); + } + } + } + else + { + WriteLine("List of valid commands for ShiftOS. \nTo get help for a specific command, type \"help \".\r\n"); + foreach (var t in TerminalBackend.instances) + { + WriteLine($"{t.Name}: {t.Summary}"); + } } } } diff --git a/ShiftOS.Main/Terminal/Commands/sftp.cs b/ShiftOS.Main/Terminal/Commands/sftp.cs new file mode 100644 index 0000000..dbc3b36 --- /dev/null +++ b/ShiftOS.Main/Terminal/Commands/sftp.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.Main.Terminal.Commands +{ + class sftp:TerminalCommand + { + public override string Name { get; } = "sftp"; + public override string Summary { get; } = "The Shift File Transfer Protocol (SFTP) Client."; + public override string Usage { get; } = "sftp "; + public override bool Unlocked { get; set; } = false; + + public override void Run(params string[] args) + { + WriteLine(args[0]); + } + } +} -- cgit v1.2.3