Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions src/Filee.Cli/Help.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Usage text of the "filee" command.

using System.Reflection;
using Filee.Core.Watching;

namespace Filee.Cli;

Expand Down Expand Up @@ -61,7 +62,7 @@ Files can be wildcards (*.heic). Folders convert the files in them that Filee kn

""";

private const string Watch = """
private static string Watch => FormattableString.Invariant($"""
Usage: filee watch <folder> (--to <format> | --preset <preset>) [options]

Converts files that land in the folder until Ctrl+C. Files are converted once they are complete (no
Expand All @@ -74,10 +75,10 @@ Files can be wildcards (*.heic). Folders convert the files in them that Filee kn
-r, --recursive Also watch sub folders (their files keep the sub folder in the output)
--move-originals Move converted sources to <folder>\originals; files already waiting are
converted at start
--settle <seconds> How long a file must stay unchanged (default 2)
--settle <seconds> How long a file must stay unchanged (default {FolderWatcher.DefaultSettleTime.TotalSeconds})
--keep-dates Give converted files the created and modified dates of the originals
--zip Save the result of each file as one ZIP (a Shapefile's files together)
--quiet Print nothing but errors

""";
""");
}
26 changes: 26 additions & 0 deletions tests/Filee.Cli.Tests/HelpTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// CLI help must describe the watcher's platform default without loading settings or engines.

using Filee.Core.Watching;

namespace Filee.Cli.Tests;

public sealed class HelpTests
{
[Theory]
[InlineData("help", "watch")]
[InlineData("watch", "--help")]
[InlineData("watch", "-h")]
public async Task Watch_help_reports_the_platform_default_without_loading_engines(string command, string option)
{
var output = new StringWriter();
var errors = new StringWriter();

var code = await Cli.RunAsync([command, option], output, errors, TestContext.Current.CancellationToken,
() => throw new InvalidOperationException("Help must not initialize engines."));

Assert.Equal(Cli.Success, code);
Assert.Equal("", errors.ToString());
Assert.Contains(FormattableString.Invariant(
$"--settle <seconds> How long a file must stay unchanged (default {FolderWatcher.DefaultSettleTime.TotalSeconds})"), output.ToString());
}
}
Loading