-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add - doc - Backported Nitrocid's shell to Termina...
...ux --- We've backported the shell implementation in to satisfy the requirements, removing some of Nitrocid-exclusive features in the process as they're out of scope for Terminaux. Nitrocid KS will not use it as it has its own shell implementation. --- Type: add Breaking: False Doc Required: True Backport Required: False Part: 1/1
- Loading branch information
Showing
79 changed files
with
596 additions
and
5,486 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
Terminaux.Console/Fixtures/Cases/Shell/Shells/Commands/Write.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Nitrocid KS Copyright (C) 2018-2024 Aptivi | ||
// | ||
// This file is part of Nitrocid KS | ||
// | ||
// Nitrocid KS is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Nitrocid KS is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY, without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
// | ||
|
||
using Terminaux.Shell.Commands; | ||
using Terminaux.Writer.ConsoleWriters; | ||
|
||
namespace Terminaux.Console.Fixtures.Cases.Shell.Shells.Commands | ||
{ | ||
class WriteCommand : BaseCommand, ICommand | ||
{ | ||
public override void Execute(CommandParameters parameters) => | ||
TextWriterColor.Write("Test text"); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Terminaux.Console/Fixtures/Cases/Shell/Shells/Commands/WriteArg.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Nitrocid KS Copyright (C) 2018-2024 Aptivi | ||
// | ||
// This file is part of Nitrocid KS | ||
// | ||
// Nitrocid KS is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Nitrocid KS is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY, without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
// | ||
|
||
using Terminaux.Shell.Commands; | ||
using Terminaux.Writer.ConsoleWriters; | ||
|
||
namespace Terminaux.Console.Fixtures.Cases.Shell.Shells.Commands | ||
{ | ||
class WriteArgCommand : BaseCommand, ICommand | ||
{ | ||
public override void Execute(CommandParameters parameters) => | ||
TextWriterColor.Write(parameters.ArgumentsText); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
Terminaux.Console/Fixtures/Cases/Shell/Shells/TestShellInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// Terminaux Copyright (C) 2023-2024 Aptivi | ||
// | ||
// This file is part of Terminaux | ||
// | ||
// Terminaux is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Terminaux is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY, without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
// | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Terminaux.Console.Fixtures.Cases.Shell.Shells.Commands; | ||
using Terminaux.Shell.Arguments; | ||
using Terminaux.Shell.Commands; | ||
using Terminaux.Shell.Shells; | ||
|
||
namespace Terminaux.Console.Fixtures.Cases.Shell.Shells | ||
{ | ||
internal class TestShellInfo : BaseShellInfo, IShellInfo | ||
{ | ||
/// <summary> | ||
/// List of commands | ||
/// </summary> | ||
public override List<CommandInfo> Commands => | ||
[ | ||
new CommandInfo("write", "Writes test text", | ||
[ | ||
new CommandArgumentInfo() | ||
], new WriteCommand()), | ||
|
||
new CommandInfo("writearg", "Writes test text with argument support", | ||
[ | ||
new CommandArgumentInfo( | ||
[ | ||
new CommandArgumentPart(true, "text") | ||
]) | ||
], new WriteArgCommand()), | ||
]; | ||
|
||
public override BaseShell ShellBase => new TestShellInstance(); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
Terminaux.Console/Fixtures/Cases/Shell/Shells/TestShellInstance.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// Terminaux Copyright (C) 2023-2024 Aptivi | ||
// | ||
// This file is part of Terminaux | ||
// | ||
// Terminaux is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Terminaux is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY, without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
// | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Terminaux.Shell.Shells; | ||
using Terminaux.Writer.ConsoleWriters; | ||
using Textify.General; | ||
|
||
namespace Terminaux.Console.Fixtures.Cases.Shell.Shells | ||
{ | ||
internal class TestShellInstance : BaseShell, IShell | ||
{ | ||
/// <inheritdoc/> | ||
public override string ShellType => "TestShell"; | ||
|
||
/// <inheritdoc/> | ||
public override bool Bail { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public override void InitializeShell(params object[] ShellArgs) | ||
{ | ||
while (!Bail) | ||
{ | ||
try | ||
{ | ||
ShellManager.GetLine(); | ||
} | ||
catch (ThreadInterruptedException) | ||
{ | ||
Bail = true; | ||
} | ||
catch (Exception ex) | ||
{ | ||
TextWriterRaw.WritePlain("There was an error in the shell." + CharManager.NewLine + "Error {0}: {1}", ex.GetType().FullName ?? "<null>", ex.Message); | ||
continue; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ internal enum FixtureCategory | |
Presentation, | ||
Console, | ||
Image, | ||
Graphics | ||
Graphics, | ||
Shell, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.