-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add - doc - Added SFTP interactive TUI
--- We've added the same set of changes to the SFTP addon as we've done to the FTP shell. --- Type: add Breaking: False Doc Required: True Backport Required: False Part: 1/1
- Loading branch information
Showing
8 changed files
with
971 additions
and
10 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
public/Nitrocid.Addons/Nitrocid.Extras.SftpShell/SFTP/Commands/Ifm.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,49 @@ | ||
// | ||
// Nitrocid KS Copyright (C) 2018-2025 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.Inputs.Interactive; | ||
using Nitrocid.Shell.ShellBase.Commands; | ||
using Nitrocid.Files.Instances; | ||
using Nitrocid.Languages; | ||
using System; | ||
using Renci.SshNet.Sftp; | ||
using Nitrocid.Extras.SftpShell.SFTP.Interactive; | ||
|
||
namespace Nitrocid.Extras.SftpShell.SFTP.Commands | ||
{ | ||
class IfmCommand : BaseCommand, ICommand | ||
{ | ||
|
||
public override int Execute(CommandParameters parameters, ref string variableValue) | ||
{ | ||
var tui = new SFTPFileManagerCli(); | ||
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, ISftpFile>(Translate.DoTranslation("Open"), ConsoleKey.Enter, (entry1, _, entry2, _) => tui.Open(entry1, entry2))); | ||
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, ISftpFile>(Translate.DoTranslation("Copy"), ConsoleKey.F1, (entry1, _, entry2, _) => tui.CopyFile(entry1, entry2))); | ||
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, ISftpFile>(Translate.DoTranslation("Move"), ConsoleKey.F2, (entry1, _, entry2, _) => tui.MoveFile(entry1, entry2))); | ||
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, ISftpFile>(Translate.DoTranslation("Delete"), ConsoleKey.F3, (entry1, _, entry2, _) => tui.RemoveFileOrDir(entry1, entry2))); | ||
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, ISftpFile>(Translate.DoTranslation("Up"), ConsoleKey.F4, (_, _, _, _) => tui.GoUp())); | ||
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, ISftpFile>(Translate.DoTranslation("Info"), ConsoleKey.F5, (entry1, _, entry2, _) => tui.PrintFileSystemEntry(entry1, entry2))); | ||
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, ISftpFile>(Translate.DoTranslation("Copy To"), ConsoleKey.F1, ConsoleModifiers.Shift, (entry1, _, entry2, _) => tui.CopyTo(entry1, entry2))); | ||
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, ISftpFile>(Translate.DoTranslation("Move to"), ConsoleKey.F2, ConsoleModifiers.Shift, (entry1, _, entry2, _) => tui.MoveTo(entry1, entry2))); | ||
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, ISftpFile>(Translate.DoTranslation("New Folder"), ConsoleKey.F7, (_, _, _, _) => tui.MakeDir())); | ||
InteractiveTuiTools.OpenInteractiveTui(tui); | ||
return 0; | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
public/Nitrocid.Addons/Nitrocid.Extras.SftpShell/SFTP/Commands/Mkldir.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,41 @@ | ||
// | ||
// Nitrocid KS Copyright (C) 2018-2025 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 Nitrocid.Files; | ||
using Nitrocid.Shell.ShellBase.Commands; | ||
|
||
namespace Nitrocid.Extras.SftpShell.SFTP.Commands | ||
{ | ||
/// <summary> | ||
/// Makes your local directory | ||
/// </summary> | ||
/// <remarks> | ||
/// This command lets you create your local directory in your connected SFTP server. | ||
/// </remarks> | ||
class MkldirCommand : BaseCommand, ICommand | ||
{ | ||
|
||
public override int Execute(CommandParameters parameters, ref string variableValue) | ||
{ | ||
string targetDir = FilesystemTools.NeutralizePath(parameters.ArgumentsList[0], SFTPShellCommon.SFTPCurrDirect); | ||
FilesystemTools.MakeDirectory(targetDir); | ||
return 0; | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
public/Nitrocid.Addons/Nitrocid.Extras.SftpShell/SFTP/Commands/Mkrdir.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,40 @@ | ||
// | ||
// Nitrocid KS Copyright (C) 2018-2025 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 Nitrocid.Extras.SftpShell.Tools.Filesystem; | ||
using Nitrocid.Shell.ShellBase.Commands; | ||
|
||
namespace Nitrocid.Extras.SftpShell.SFTP.Commands | ||
{ | ||
/// <summary> | ||
/// Makes your remote directory | ||
/// </summary> | ||
/// <remarks> | ||
/// This command lets you create your remote directory in your connected SFTP server. | ||
/// </remarks> | ||
class MkrdirCommand : BaseCommand, ICommand | ||
{ | ||
|
||
public override int Execute(CommandParameters parameters, ref string variableValue) | ||
{ | ||
SFTPFilesystem.SFTPMakeDirectory(parameters.ArgumentsList[0]); | ||
return 0; | ||
} | ||
} | ||
} |
Oops, something went wrong.