Catch wrong commands.

This commit is contained in:
Tony Bark 2021-03-30 10:01:34 -04:00
parent af6bab2e4f
commit d1ccfad2ae
2 changed files with 20 additions and 6 deletions

View file

@ -35,10 +35,16 @@ namespace Tomas.Kernel
{ {
var shell = new Shell(); var shell = new Shell();
var command = shell.ReadLine; var command = shell.ReadLine;
OSConsts.Programs.TryGetValue(command, out var program);
var isRun = program.Start();
if (isRun) continue; if (!OSConsts.Programs.TryGetValue(command, out var program))
{
Console.WriteLine("Command Unknown.");
continue;
}
var start = program.Start();
if (start) continue;
break; break;
} }
} }

View file

@ -1,5 +1,7 @@
// I license this project under the GPL 3.0 license. // I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
namespace Tomas.Terminal namespace Tomas.Terminal
{ {
class Program class Program
@ -10,10 +12,16 @@ namespace Tomas.Terminal
{ {
var shell = new Shell(); var shell = new Shell();
var command = shell.ReadLine; var command = shell.ReadLine;
TermConsts.Programs.TryGetValue(command, out var program);
var isRun = program.Start();
if (isRun) continue; if (!TermConsts.Programs.TryGetValue(command, out var program))
{
Console.WriteLine("Command Unknown.");
continue;
}
var start = program.Start();
if (start) continue;
break; break;
} }
} }