Skip to content

Commit

Permalink
Code quality fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elzik committed Sep 15, 2023
1 parent 07e2028 commit 4bf9f67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public void SyncCreationDates(string directoryPath)

_logger.LogDebug("Synchronising {FilenamePattern} files in {DirectoryPath}", _options.FilenamePattern, directoryPath);

var markdownFiles = _directory.EnumerateFiles(directoryPath, _options.FilenamePattern, new EnumerationOptions
var markdownFiles = _directory.EnumerateFiles(directoryPath, _options.FilenamePattern ?? string.Empty,
new EnumerationOptions
{
MatchCasing = MatchCasing.CaseInsensitive,
RecurseSubdirectories = true
Expand Down
9 changes: 2 additions & 7 deletions src/Elzik.FmSync.Worker/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@
using Thinktecture.IO.Adapters;
using Thinktecture.IO;

IHost host = Host.CreateDefaultBuilder(args)
var host = Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) =>
{
var configuration = hostContext.Configuration;

const string optionsKey = "FmSyncOptions";
var options = configuration.GetSection(optionsKey).Get<FmSyncOptions>();
if (options == null)
{
throw new InvalidOperationException(
var options = configuration.GetSection(optionsKey).Get<FmSyncOptions>() ?? throw new InvalidOperationException(
$"{optionsKey} configuration could not be found.");
}

services.AddSingleton(options);
services.AddSingleton<IMarkdownFrontMatter, MarkdownFrontMatter>();
services.AddSingleton<IFile, FileAdapter>();
Expand Down

0 comments on commit 4bf9f67

Please sign in to comment.