2021-09-27 12:42:46 +00:00
|
|
|
using System.CommandLine;
|
|
|
|
using System.CommandLine.Invocation;
|
2022-09-29 05:10:49 +00:00
|
|
|
using System.CommandLine.NamingConventionBinder;
|
2021-09-27 12:42:46 +00:00
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
2022-10-14 22:08:21 +00:00
|
|
|
using Wabbajack.CLI.Builder;
|
2021-09-27 12:42:46 +00:00
|
|
|
using Wabbajack.Paths;
|
|
|
|
using Wabbajack.VFS;
|
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
namespace Wabbajack.CLI.Verbs;
|
|
|
|
|
2022-10-14 22:08:21 +00:00
|
|
|
public class VFSIndex
|
2021-09-27 12:42:46 +00:00
|
|
|
{
|
2021-10-23 16:51:17 +00:00
|
|
|
private readonly Context _context;
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2022-10-01 01:35:36 +00:00
|
|
|
public VFSIndex(Context context)
|
2021-10-23 16:51:17 +00:00
|
|
|
{
|
|
|
|
_context = context;
|
|
|
|
}
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2022-10-14 22:08:21 +00:00
|
|
|
public static VerbDefinition Definition = new("vfs-index",
|
2022-10-01 01:35:36 +00:00
|
|
|
"Index and cache the contents of a folder", new[]
|
|
|
|
{
|
|
|
|
new OptionDefinition(typeof(AbsolutePath), "f", "folder", "Folder to index")
|
|
|
|
});
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
public async Task<int> Run(AbsolutePath folder)
|
|
|
|
{
|
|
|
|
await _context.AddRoot(folder, CancellationToken.None);
|
|
|
|
return 0;
|
2021-09-27 12:42:46 +00:00
|
|
|
}
|
|
|
|
}
|