Skip to content

Commit

Permalink
fix(cli): missing option class
Browse files Browse the repository at this point in the history
  • Loading branch information
ToaHartor committed Jul 11, 2024
1 parent d196547 commit eeddc7c
Showing 1 changed file with 46 additions and 37 deletions.
83 changes: 46 additions & 37 deletions src/Parameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,18 @@ internal sealed class DemuxOptions
public string? audioLang;
}

internal sealed class DemuxOptionsBinder : BinderBase<DemuxOptions>
internal sealed class DemuxOptionsBinder(Option<string> key1Option, Option<string> key2Option, Option<DirectoryInfo> outputFolderOption, Option<string> mkvEngineOption, Option<bool> mergeOption, Option<bool> subsOption, Option<bool> noCleanupOption, Option<string> audioFormatOption, Option<string> videoFormatOption, Option<string> audioLangOption) : BinderBase<DemuxOptions>
{
private Option<string> Key1Option { get; }
private Option<string> Key2Option { get; }
private Option<DirectoryInfo> OutputFolderOption { get; }
private Option<string> MkvEngineOption { get; }
private Option<bool> MergeOption { get; }
private Option<bool> SubsOption { get; }
private Option<bool> NoCleanupOption { get; }
private Option<string> AudioFormatOption { get; }
private Option<string> VideoFormatOption { get; }
private Option<string> AudioLangOption { get; }

public DemuxOptionsBinder(Option<string> key1Option, Option<string> key2Option, Option<DirectoryInfo> outputFolderOption, Option<string> mkvEngineOption, Option<bool> mergeOption, Option<bool> subsOption, Option<bool> noCleanupOption, Option<string> audioFormatOption, Option<string> videoFormatOption, Option<string> audioLangOption)
{
Key1Option = key1Option;
Key2Option = key2Option;
OutputFolderOption = outputFolderOption;
MkvEngineOption = mkvEngineOption;
MergeOption = mergeOption;
SubsOption = subsOption;
NoCleanupOption = noCleanupOption;
AudioFormatOption = audioFormatOption;
VideoFormatOption = videoFormatOption;
AudioLangOption = audioLangOption;
}
private Option<string> Key1Option { get; } = key1Option;
private Option<string> Key2Option { get; } = key2Option;
private Option<DirectoryInfo> OutputFolderOption { get; } = outputFolderOption;
private Option<string> MkvEngineOption { get; } = mkvEngineOption;
private Option<bool> MergeOption { get; } = mergeOption;
private Option<bool> SubsOption { get; } = subsOption;
private Option<bool> NoCleanupOption { get; } = noCleanupOption;
private Option<string> AudioFormatOption { get; } = audioFormatOption;
private Option<string> VideoFormatOption { get; } = videoFormatOption;
private Option<string> AudioLangOption { get; } = audioLangOption;

protected override DemuxOptions GetBoundValue(BindingContext bindingContext) =>
new DemuxOptions
Expand All @@ -65,16 +51,39 @@ protected override DemuxOptions GetBoundValue(BindingContext bindingContext) =>
};
}

//internal sealed class BatchDemuxOptions
//{
// usmFolderArg,
// subsOption,
// mergeOption,
// mkvEngineOption,
// audioFormatOption,
// videoFormatOption,
// outputFolderOption,
// noCleanupOption,
// audioLangOption
//}
internal sealed class BatchDemuxOptions
{
public DirectoryInfo? output;
public bool? subs;
public bool? merge;
public string? engine;
public string? audioFormat;
public string? videoFormat;
public bool? noCleanup;
public string? audioLang;
}

internal sealed class BatchDemuxOptionsBinder(Option<DirectoryInfo> outputFolderOption, Option<string> mkvEngineOption, Option<bool> mergeOption, Option<bool> subsOption, Option<bool> noCleanupOption, Option<string> audioFormatOption, Option<string> videoFormatOption, Option<string> audioLangOption) : BinderBase<BatchDemuxOptions> {
private Option<DirectoryInfo> OutputFolderOption { get; } = outputFolderOption;
private Option<bool> SubsOption { get; } = subsOption;
private Option<bool> MergeOption { get; } = mergeOption;
private Option<string> MkvEngineOption { get; } = mkvEngineOption;
private Option<string> AudioFormatOption { get; } = audioFormatOption;
private Option<string> VideoFormatOption { get; } = videoFormatOption;
private Option<bool> NoCleanupOption { get; } = noCleanupOption;
private Option<string> AudioLangOption { get; } = audioLangOption;

protected override BatchDemuxOptions GetBoundValue(BindingContext bindingContext) =>
new BatchDemuxOptions
{
output = bindingContext.ParseResult.GetValueForOption(OutputFolderOption),
engine = bindingContext.ParseResult.GetValueForOption(MkvEngineOption),
merge = bindingContext.ParseResult.GetValueForOption(MergeOption),
subs = bindingContext.ParseResult.GetValueForOption(SubsOption),
noCleanup = bindingContext.ParseResult.GetValueForOption(NoCleanupOption),
audioFormat = bindingContext.ParseResult.GetValueForOption(AudioFormatOption),
videoFormat = bindingContext.ParseResult.GetValueForOption(VideoFormatOption),
audioLang = bindingContext.ParseResult.GetValueForOption(AudioLangOption)
};
}
}

0 comments on commit eeddc7c

Please sign in to comment.