atifaziz / NCrontab

Crontab for .NET
Apache License 2.0
913 stars 139 forks source link

Remove necessity of ParseOptions #94

Closed angelaki closed 2 years ago

angelaki commented 3 years ago

Right now the only setting available is IncludingSeconds. But why does this need to be set at all? Right now I just use IncludingSeconds = value.Split(' ').Length > 5.

If actually wanted I'd recommend an enum e.g.

[Flags]
enum ParseMode : short
{
   Explicit,
   IncludeSeconds
};

with a default value of IncludeSeconds. This way you could still use Explicit or Explicit | IncludeSeconds for the current behavior and its generic by default.

atifaziz commented 2 years ago

But why does this need to be set at all?

Because it's a more future-proof approach in case other options need to be added that may not be simple Booleans (which is what an enum-based approach with flags would be too).