Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add option to pass in directory to update all chapters #96

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions ListingManager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ private static int Main(string[] args)
name: "--preview",
description: "Writes all logs to console as if changes will be made without actually making changes.");

var allChaptersOption = new Option<bool>(
name: "--allChapters",
description: "The passed in path is the parent directory to many chapter directories rather than a single chapter directory.");

// TODO: Add better descriptions when their functionality becomes clearer
var byFolderOption = new Option<bool>(
name: "--byfolder",
Expand All @@ -42,7 +46,8 @@ private static int Main(string[] args)
verboseOption,
previewOption,
byFolderOption,
singleDirOption
singleDirOption,
allChaptersOption
};

// Give better description when intent and functionality becomes more flushed out
Expand All @@ -57,13 +62,20 @@ private static int Main(string[] args)
scanForMismatchedListings
};

listingUpdating.SetHandler((directoryIn, verbose, preview, byFolder, singleDir) =>
listingUpdating.SetHandler((directoryIn, verbose, preview, byFolder, singleDir, allChapters) =>
{
Console.WriteLine(IntelliTect);
Console.WriteLine($"Updating listings within: {directoryIn}");
ListingManager listingManager = new(directoryIn);
listingManager.UpdateChapterListingNumbers(directoryIn, verbose, preview, byFolder, singleDir);
}, directoryIn, verboseOption, previewOption, byFolderOption, singleDirOption);
if (allChapters)
{
listingManager.UpdateAllChapterListingNumbers(directoryIn, verbose, preview, byFolder, singleDir);
}
else
{
listingManager.UpdateChapterListingNumbers(directoryIn, verbose, preview, byFolder, singleDir);
}
}, directoryIn, verboseOption, previewOption, byFolderOption, singleDirOption, allChaptersOption);

scanForMismatchedListings.SetHandler((directoryIn) =>
{
Expand Down