Set up options and arguments for install command.
This commit is contained in:
55
MCCFMD/Commands/Install.cs
Normal file
55
MCCFMD/Commands/Install.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.CommandLine;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MCCFMD.Commands
|
||||
{
|
||||
public class Install : Command
|
||||
{
|
||||
const string NAME = "install";
|
||||
const string DESC = "Install the profile described by the manifest.";
|
||||
public Install(DirectoryInfo workspaceDir) : base(NAME, DESC)
|
||||
{
|
||||
Argument<FileInfo> profileFile = new Argument<FileInfo>("profile", "The .zip file describing the profile to install.");
|
||||
Add(profileFile);
|
||||
|
||||
Option<DirectoryInfo?> destination = new Option<DirectoryInfo?>("--destination", "Where to install the profile.");
|
||||
destination.AddAlias("-d");
|
||||
Add(destination);
|
||||
|
||||
Option<bool> server = new Option<bool>("--server", "Install server files.");
|
||||
server.AddAlias("-s");
|
||||
Add(server);
|
||||
|
||||
Option<DirectoryInfo?> client = new Option<DirectoryInfo?>("--client", "Install files in local client.");
|
||||
client.AddAlias("-c");
|
||||
Add(client);
|
||||
|
||||
Option<FileInfo?> fileExclude = new Option<FileInfo?>("--exclude-file", "Excludes files with IDs listed in a given file.");
|
||||
fileExclude.AddAlias("-E");
|
||||
Add(fileExclude);
|
||||
|
||||
Option<FileInfo?> fileInclude = new Option<FileInfo?>("--include-file", "Includes files with IDs listed in a given file.");
|
||||
fileInclude.AddAlias("-I");
|
||||
Add(fileInclude);
|
||||
|
||||
Option<IEnumerable<FileInfo>> excludeIds = new Option<IEnumerable<FileInfo>>
|
||||
("--exclude-id", "Excludes the files with the given IDs.");
|
||||
excludeIds.AllowMultipleArgumentsPerToken = true;
|
||||
excludeIds.AddAlias("-e");
|
||||
Add(excludeIds);
|
||||
|
||||
Option<IEnumerable<FileInfo>> includeIds = new Option<IEnumerable<FileInfo>>("--include-id", "Include the files with the given IDs");
|
||||
includeIds.AllowMultipleArgumentsPerToken = true;
|
||||
includeIds.AddAlias("-i");
|
||||
Add(includeIds);
|
||||
|
||||
this.SetHandler(async (FileInfo profileFile, DirectoryInfo? dest, bool server, bool client, FileInfo? fileExclude, FileInfo? fileInclude, IEnumerable<FileInfo> excludeIds, IEnumerable<FileInfo> includeIds) =>
|
||||
{
|
||||
|
||||
}, profileFile, destination, client, fileExclude, fileInclude, excludeIds, includeIds);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user