mirror of
https://github.com/tonytins/tomas.git
synced 2025-04-30 03:31:39 -04:00
Catch wrong commands.
This commit is contained in:
parent
af6bab2e4f
commit
d1ccfad2ae
2 changed files with 20 additions and 6 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue