Skip to content

Commit

Permalink
add - doc - Added IFM for FTP (local/remote)
Browse files Browse the repository at this point in the history
---

We've finally added an interactive file manager for FTP servers! It brings
local/remote interaction.

---

Type: add
Breaking: False
Doc Required: True
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Jan 21, 2025
1 parent 296d2be commit 79c69ca
Show file tree
Hide file tree
Showing 4 changed files with 906 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// 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 Nitrocid.Extras.FtpShell.FTP.Interactive;
using FluentFTP;

namespace Nitrocid.Extras.FtpShell.FTP.Commands
{
class IfmCommand : BaseCommand, ICommand
{

public override int Execute(CommandParameters parameters, ref string variableValue)
{
var tui = new FtpFileManagerCli();
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, FtpListItem>(Translate.DoTranslation("Open"), ConsoleKey.Enter, (entry1, _, entry2, _) => tui.Open(entry1, entry2)));
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, FtpListItem>(Translate.DoTranslation("Copy"), ConsoleKey.F1, (entry1, _, entry2, _) => tui.CopyFileOrDir(entry1, entry2)));
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, FtpListItem>(Translate.DoTranslation("Move"), ConsoleKey.F2, (entry1, _, entry2, _) => tui.MoveFileOrDir(entry1, entry2)));
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, FtpListItem>(Translate.DoTranslation("Delete"), ConsoleKey.F3, (entry1, _, entry2, _) => tui.RemoveFileOrDir(entry1, entry2)));
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, FtpListItem>(Translate.DoTranslation("Up"), ConsoleKey.F4, (_, _, _, _) => tui.GoUp()));
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, FtpListItem>(Translate.DoTranslation("Info"), ConsoleKey.F5, (entry1, _, entry2, _) => tui.PrintFileSystemEntry(entry1, entry2)));
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, FtpListItem>(Translate.DoTranslation("Copy To"), ConsoleKey.F1, ConsoleModifiers.Shift, (entry1, _, entry2, _) => tui.CopyTo(entry1, entry2)));
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, FtpListItem>(Translate.DoTranslation("Move to"), ConsoleKey.F2, ConsoleModifiers.Shift, (entry1, _, entry2, _) => tui.MoveTo(entry1, entry2)));
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, FtpListItem>(Translate.DoTranslation("Rename"), ConsoleKey.F6, (entry1, _, entry2, _) => tui.Rename(entry1, entry2)));
tui.Bindings.Add(new InteractiveTuiBinding<FileSystemEntry, FtpListItem>(Translate.DoTranslation("New Folder"), ConsoleKey.F7, (_, _, _, _) => tui.MakeDir()));
InteractiveTuiTools.OpenInteractiveTui(tui);
return 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ internal class FTPShellInfo : BaseShellInfo, IShellInfo
})
], new GetFolderCommand()),

new CommandInfo("ifm", /* Localizable */ "Interactive system host file manager",
[
new CommandArgumentInfo()
], new IfmCommand()),

new CommandInfo("info", /* Localizable */ "FTP server information",
[
new CommandArgumentInfo()
Expand Down
Loading

0 comments on commit 79c69ca

Please sign in to comment.